-
Notifications
You must be signed in to change notification settings - Fork 0
/
Post.js
34 lines (33 loc) · 904 Bytes
/
Post.js
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
import React from 'react';
import { View, TouchableOpacity, StyleSheet } from 'react-native';
import FastImage from 'react-native-fast-image';
import { useNavigation } from '@react-navigation/core';
export const Post = React.memo((props) => {
const styles = StyleSheet.create({
container: {
borderColor: 'white',
margin: props.type === 'all' ? 0 : 1,
},
});
const navigation = useNavigation();
return (
<TouchableOpacity
style={styles.container}
onPress={() => {
navigation.navigate('all-posts', {
posts: props.posts,
id: props.id - 1,
});
}}
>
<FastImage
style={{
width: props.type === 'all' ? '100%' : 120,
height: props.type === 'all' ? 380 : 120,
}}
source={props.img}
resizeMode={FastImage.resizeMode.cover}
/>
</TouchableOpacity>
);
});