Last active
May 20, 2019 02:31
-
-
Save PavanKu/f3fae786d0798cee87e909b231f45311 to your computer and use it in GitHub Desktop.
Revisions
-
PavanKu revised this gist
May 20, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ import React from 'react'; import { View, Text, Image, ActivityIndicator, StyleSheet, ScrollView } from "react-native"; const initialState = { pictures: [ {id:0, download_url:"https://picsum.photos/id/0/5616/3744" }, -
PavanKu revised this gist
May 20, 2019 . No changes.There are no files selected for viewing
-
PavanKu created this gist
May 20, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ import React from 'react'; import { View, Text, Image, ActivityIndicator, StyleSheet, FlatList } from "react-native"; const initialState = { pictures: [ {id:0, download_url:"https://picsum.photos/id/0/5616/3744" }, {id:1, download_url: "https://picsum.photos/id/1002/4312/2868"}, {id:2, download_url: "https://picsum.photos/id/1006/3000/2000"}, {id:3, download_url: "https://picsum.photos/id/1015/6000/4000"} ] }; class PictureList extends React.Component { constructor(props) { super(props); this.state = initialState; } render() { const { pictures } = this.state; if (!pictures.length) { return (<ActivityIndicator />); } return ( <View> <ScrollView> {pictures.map(picture => ( <View style={styles.container} key={picture.id}> <Image style={styles.image} source={{uri: picture.download_url}} /> </View> ))} /> </View> ); } } const styles = StyleSheet.create({ container: { borderColor: '#ccc', borderWidth: 1, borderRadius: 5, backgroundColor: '#eaf7fd', marginBottom: 15, }, image: { margin: 5, borderRadius: 5, width: 300, height: 300, } }); export default PictureList;