-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIndex.js
41 lines (37 loc) · 961 Bytes
/
Index.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
35
36
37
38
39
40
41
import React, { useEffect, useCallback, useState } from 'react';
import { View, Text } from 'react-native';
import styles from 'styles/public';
import { connect } from 'react-redux';
import { loadUserImgs } from 'redux-actions/usersAction';
// components
import RenderImage from 'components/RenderImage';
const Index = props => {
const [images, setImages] = useState(null);
useEffect(() => {
props.loadUserImgs();
if (props.users.images) {
setImages(props.users.images);
}
}, [images]);
return (
props.users && (
<View style={[styles.full, styles.fullcenter, { paddingTop: 44 }]}>
<RenderImage
navToDetail={(item, index) =>
props.navigation.navigate('Detail', { item, index })
}
images={images}
/>
</View>
)
);
};
const mapProps = state => {
return {
users: state.users,
};
};
export default connect(
mapProps,
{ loadUserImgs },
)(Index);