React Native | Section List with example
App.js:
import React from 'react';
import { SectionList, Text, View } from 'react-native';
const App=()=>{
users=[
{
id:1,
name:"Krishan",
data:["Angular", "HTML", "CSS", "JavaScript"]
},
{
id:1,
name:"Krishan",
data:["HTML","Angular", "CSS", "JavaScript"]
},
{
id:1,
name:"Krishan",
data:["CSS", "Angular", "HTML", "JavaScript"]
}
]
return(
<View>
<Text style={{fontSize:25, backgroundColor:'blue', color:'white'}}>React Native | Section List with example
</Text>
<SectionList
sections={users}
renderItem={({item})=><Text style={{marginLeft:20, fontSize:20}}>{item}</Text>}
renderSectionHeader={({section:{name}})=>(
<Text style={{fontSize:20, color:'red'}}>{name}</Text>
)}
/>
</View>
)
}
export default App;
Comments
Post a Comment