Skip to content

Instantly share code, notes, and snippets.

@balascript
Created July 12, 2020 19:45
Show Gist options
  • Save balascript/d9de28008a1b0c61ac2d17cc8aad0b25 to your computer and use it in GitHub Desktop.
Save balascript/d9de28008a1b0c61ac2d17cc8aad0b25 to your computer and use it in GitHub Desktop.
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