aboutsummaryrefslogtreecommitdiff
path: root/src/components/moments/MomentTile.tsx
blob: 96eb35b6131b5888259eb861dc0d62e061974408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {useNavigation} from '@react-navigation/native';
import React from 'react';
import {StyleSheet, View, Image, TouchableOpacity} from 'react-native';
import {MomentType, ScreenType} from '../../types';

interface MomentTileProps {
  moment: MomentType;
  userXId: string | undefined;
  screenType: ScreenType;
}
const MomentTile: React.FC<MomentTileProps> = ({
  moment,
  userXId,
  screenType,
}) => {
  const navigation = useNavigation();

  return (
    <TouchableOpacity
      onPress={() => {
        navigation.push('IndividualMoment', {
          moment,
          screenType,
          userXId,
        });
      }}>
      <View style={styles.image}>
        <Image style={styles.image} source={{uri: moment.thumbnail_url}} />
      </View>
    </TouchableOpacity>
  );
};

const styles = StyleSheet.create({
  image: {
    aspectRatio: 1,
    height: '100%',
    alignItems: 'center',
    justifyContent: 'center',
    flexDirection: 'column',
    marginRight: 5,
  },
});
export default MomentTile;