Skip to content

Instantly share code, notes, and snippets.

@Charpell
Created July 7, 2019 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Charpell/d998d24e3b3124c09816199524af6c8a to your computer and use it in GitHub Desktop.
Save Charpell/d998d24e3b3124c09816199524af6c8a to your computer and use it in GitHub Desktop.
import React from 'react'
import { TouchableOpacity, FlatList } from 'react-native'
import styled from 'styled-components';
import metrics from '../utils/metrics';
export default ImageList = ({ navigation, images }) => {
return (
<FlatList
data={images}
horizontal
keyExtractor={(i, t) => t.toString()}
style={{ height: 146 }}
contentContainerStyle={{ height: 146 }}
renderItem={({ item }) => (
<TouchableOpacity
onPress={() => navigation.navigate('Book', { image: item.uri })}
>
<Image source={{ uri: item.uri }}/>
</TouchableOpacity>
)}
/>
)
}
const Image = styled.Image`
width: ${metrics.width * 0.3};
height: ${metrics.height * 0.17};
border-radius: 15px;
margin: 10px;
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment