Skip to content

Instantly share code, notes, and snippets.

@anasAlsalol
Forked from sergioutama/multi_section.jsx
Created July 15, 2018 15:34
Show Gist options
  • Select an option

  • Save anasAlsalol/8d679128b67a4c3a1f8783217a49dbf2 to your computer and use it in GitHub Desktop.

Select an option

Save anasAlsalol/8d679128b67a4c3a1f8783217a49dbf2 to your computer and use it in GitHub Desktop.
Multi section with horizontal FlatList
export default class Screen extends React.Component {
renderItem({ item }) {
return <Row stall={item} didSelectRow={this.didSelectRow} />;
}
renderHorizontalSection = ({ item }) => {
return (
<FlatList
data={["horizontaol_item1","horizontal_item2"]}
renderItem={this.renderItem}
horizontal={true}
/>
);
};
render(){
return (
return (
<SectionList
sections={[
{
data: [""], // this is just a dumy data to display 1 item
renderItem: this.renderHorizontalSection,
keyExtractor: this.keyExtractor,
key: "Horizontal Section",
},
{
data: ["vertical item1","vertical item2"],
keyExtractor: this.keyExtractor,
renderItem: this.renderItem,
key: "Vertical section"
}
]}
automaticallyAdjustContentInsets={true}
/>
);
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment