I really dont know why I am not receiving the right collection’s field name in the JSON. I am trying to make a FlatList of a “list”.
This is what I am receiving:
I was supposed to receive a field called “Name” and not a code like c _788by4y4n4y like in the example.
My manifest:
{
"displayName": "TestComponent",
"defaultWidth": 160,
"defaultHeight": 24,
"components": "./index.js",
"icon": "./example-thumbnail.png",
"props": [
{
"name": "listProp",
"displayName": "What is this a list of?",
"type": "list"
},
{
"name": "text",
"displayName": "Text",
"type": "text",
"default": "Happy Hacking"
},
{
"name": "color",
"displayName": "Color",
"type": "color",
"default": "#00A898"
}
]
}```
My index.js:
import React from ‘react’
import { Text, View, StyleSheet, FlatList } from ‘react-native’
const renderItem = ({ item }) => (
<View style={styles.wrapper}>
<Text style={{ color: 'black' }}>item --- {item.Nome}</Text>
</View>
);
const TestComponent = ( props ) => {
const { listProp } = props
return(
<>
<Text>{JSON.stringify(listProp)}</Text>
<FlatList
data={listProp}
renderItem={renderItem}
keyExtractor={item => item.id}
/>
</>
)
}
const styles = StyleSheet.create({
wrapper: {
display: ‘flex’,
alignItems: ‘center’,
justifyContent: ‘center’,
backgroundColor: ‘#ccc’
}
})
export default TestComponent