Last active
June 8, 2018 18:34
-
-
Save streetsmartdev/20d4099f0abca7c18d90976c20ff5ff5 to your computer and use it in GitHub Desktop.
This file contains 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, { Component } from "react"; | |
import { FlatList, Text } from "react-native"; | |
import { Card } from "react-native-elements"; | |
const data = [ | |
{ | |
imageUrl: "http://via.placeholder.com/160x160", | |
title: "something" | |
}, | |
{ | |
imageUrl: "http://via.placeholder.com/160x160", | |
title: "something two" | |
}, | |
{ | |
imageUrl: "http://via.placeholder.com/160x160", | |
title: "something three" | |
}, | |
{ | |
imageUrl: "http://via.placeholder.com/160x160", | |
title: "something four" | |
}, | |
{ | |
imageUrl: "http://via.placeholder.com/160x160", | |
title: "something five" | |
}, | |
{ | |
imageUrl: "http://via.placeholder.com/160x160", | |
title: "something six" | |
} | |
]; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
data: data | |
}; | |
} | |
render() { | |
return ( | |
<FlatList | |
data={this.state.data} | |
renderItem={({ item: rowData }) => { | |
return ( | |
<Card | |
title={null} | |
image={{ uri: "http://via.placeholder.com/160x160" }} | |
containerStyle={{ padding: 0, width: 160 }} | |
> | |
<Text style={{ marginBottom: 10 }}> | |
hello | |
</Text> | |
</Card> | |
); | |
}} | |
keyExtractor={(item, index) => index} | |
/> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment