My text is not being displayed when using props (React Native)

46 views Asked by At

Components file:

function GoalItem(props) {
    return( 
          <Text style={Styles.prop}>{props.text}</Text>  
    );
}
export default GoalItem;

App file:

<FlatList data={(list)} renderItem={(itemData) => {
    <GoalItem text={(itemData.item.value)} />
}}
keyExtractor={(item, index) => {
    return item.id
}}/>
1

There are 1 answers

0
MayorMayo On

Your renderItem function has no return statement. Try this:

<FlatList data={(list)} renderItem={(itemData) => {
          return <GoalItem text={(itemData.item.value)} />
        
      }}
      keyExtractor={(item, index) => {
        return item.id
      }}/>