I am going to show an array of items but it is not working, and no error showing up. When I map function with Text component it is working fine. here is my code
import React from 'react';
import {FlatList, StyleSheet, Text, View} from 'react-native';
const AboutScreen = () => {
const myArray = ['one', 'two', 'three', 'four', 'five', 'six'];
return (
<View style={styles.container}>
<FlatList
sections={myArray}
keyExtractor={(item, index) => item + index}
renderItem={({item}) => <Text style={styles.text}>{item}</Text>}
/>
</View>
);
};
export default AboutScreen;
const styles = StyleSheet.create({
container: {
flex: 1,
},
text: {
color: 'red',
},
});
When I use ListEmptyComponent={<Text>No data found</Text>} its showing "No data found" text on simulator.