FlatList | Make list in React native

 App.js:


import React from 'react';
import { FlatList, StyleSheet, Text, View } from 'react-native';

const Users=[
    {
        id:1,
        name:"Krishan"
    },
    {
        id:1,
        name:"Bhavesh"
    },
    {
        id:1,
        name:"Sanju"
    },
    {
        id:1,
        name:"Brijesh"
    },
    {
        id:1,
        name:"Raj"
    }
]

const App=()=>{
    return(
        <View>
        <Text style={{fontSize:30}}>List With Flat List Component</Text>

        <FlatList
        data={Users}
        renderItem={({item})=><Text style={styles.item}>{item.name}</Text>}
        />
        </View>
    );
};

const styles=StyleSheet.create({
    item:{
        fontSize:24,
        color:'white',
        backgroundColor:'blue',
        borderColor:'black',
        borderWidth:1,
        margin:10,
        padding:10
    }
})

export default App;





Comments

Popular posts from this blog

Send Data Child to Parent Component - React Js

Hide , Show and Toggle in ReactJs

Importance Of Web Content In SEO.