Created
July 12, 2020 19:45
-
-
Save balascript/d9de28008a1b0c61ac2d17cc8aad0b25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const UnsplashFeed = props => { | |
const [photos, fetchMore] = useUnsplashPhotos('dogs'); | |
const renderItem = ({ item, index }) => { | |
const { uri } = item; | |
return ( | |
<Image | |
source={{ | |
uri, | |
}} | |
style={{ height: 400 }} | |
resizeMode="cover" | |
/> | |
); | |
}; | |
return ( | |
<View style={{ flex: 1 }}> | |
<FlatList | |
data={photos} | |
renderItem={renderItem} | |
onEndReachedThreshold={0.9} | |
onEndReached={fetchMore} | |
/> | |
</View> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment