-
Notifications
You must be signed in to change notification settings - Fork 0
/
19_sectionlist.js
46 lines (35 loc) · 1.18 KB
/
19_sectionlist.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react';
import { Text, View, FlatList,SectionList } from 'react-native';
const App = () => {
const users= [
{name:'Ankur',id:1,data:['phone','laptop','tv']},
{name:'Ankur',id:2,data:['phone','laptop','tv'] },
{name:'Ankur',id:3,data:['phone','laptop','tv'] },
{name:'Ankur',id:4,data:['phone','laptop','tv'] },
{name:'Ankur',id:5,data:['phone','laptop','tv'] },
{name:'Ankur',id:6,data:['phone','laptop','tv'] },
{name:'Ankur',id:7,data:['phone','laptop','tv'] },
{name:'Ankur',id:8,data:['phone','laptop','tv'] },
{name:'Ankur',id:9,data:['phone','laptop','tv'] },
{name:'Ankur',id:10,data:['phone','laptop','tv'] },
{name:'Ankur',id:11,data:['phone','laptop','tv'] },
{name:'Ankur',id:12,data:['phone','laptop','tv'] },
]
return (
<View>
<Text>SectionList</Text>
<SectionList
sections={users}
renderItem={({item})=>{
return(
<Text style={{fontSize:20,marginLeft:10}}>{item}</Text>
)
}}
renderSectionHeader={({section:{name}})=>(
<Text style={{fontSize:30,color:'red'}}>{name}</Text>
)}
/>
</View>
);
};
export default App;