Skip to content

Instantly share code, notes, and snippets.

@streetsmartdev
Last active June 8, 2018 18:34
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 streetsmartdev/20d4099f0abca7c18d90976c20ff5ff5 to your computer and use it in GitHub Desktop.
Save streetsmartdev/20d4099f0abca7c18d90976c20ff5ff5 to your computer and use it in GitHub Desktop.
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