Skip to content

Instantly share code, notes, and snippets.

@chummypixels
Created November 27, 2019 10:05
Show Gist options
  • Save chummypixels/4588f844dc91904338adfa862597517e to your computer and use it in GitHub Desktop.
Save chummypixels/4588f844dc91904338adfa862597517e to your computer and use it in GitHub Desktop.
Adding Data to the sections props of SectionList React Native
import React from 'react';
import {StyleSheet, ScrollView, View, Text, SectionList} from 'react-native';
export default class SectionListBasics extends React.Component {
render() {
return (
<View style={styles.container}>
<SectionList
sections={[
{
title: 'Top Google Seaches in 2018',
data: [
'World Cup',
'Avicii',
'Mac Miller',
'Stan Lee',
'Black Panther',
],
},
{
title: 'Top News Trends of 2018',
data: [
'World Cup',
'Hurricane Florence',
'Mega Millions Result',
'Royal Wedding',
'Election Results',
],
},
{
title: 'Top Searched Movies of 2018',
data: [
'Black Panther',
'Dead Pool 2',
'Venom',
'Avengers: Infinity War',
'Bohemian Rhapsody',
],
},
{
title: 'Top Searched Athletes of 2018',
data: [
'Tristan Thompson',
'Alexis Sánchez',
'Lindsey Vonn',
'Shaun White',
'Khabib Nurmagomedov',
],
},
]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment