Created
January 26, 2020 12:12
-
-
Save ozcanzaferayan/4708a2c5de50e5d203372c6c90e3c5ab 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
import React from 'react'; | |
import { Image, TouchableOpacity, FlatList, } from 'react-native'; | |
import colors from 'res/colors'; | |
const AddPostScreen = () => { | |
const dataSource = [ { key: '1' }, { key: '2' }, { key: '3' }, { key: '4' }, { key: '5' }, { key: '6' }, { key: '7' }, { key: '8' }, { key: '9' }, { key: '10' }, { key: '11' }, { key: '12' }, { key: '13' }, { key: '14' }, ]; | |
renderItem = () => { | |
return ( | |
<TouchableOpacity | |
onPress={() => console.log("test")} | |
style={{ flex: 1, aspectRatio: 1 }}> | |
<Image style={{ flex: 1 }} resizeMode='cover' source={{ uri: 'https://picsum.photos/512' }}></Image> | |
</TouchableOpacity> | |
); | |
} | |
return ( | |
<FlatList | |
style={{ flex: 1, backgroundColor: colors.background }} | |
data={dataSource} | |
renderItem={this.renderItem} | |
keyExtractor={(item) => item.key} | |
numColumns={4} | |
ListHeaderComponent={() => | |
<TouchableOpacity style={{ flex: 1, aspectRatio: 1 }}> | |
<Image style={{ flex: 1 }} resizeMode='cover' source={{ uri: 'https://picsum.photos/512' }}></Image> | |
</TouchableOpacity> | |
} | |
/> | |
); | |
}; | |
export default AddPostScreen; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment