I am using React-Native , and want to get the value of selected item
of Picker and and add it to FlatList This is my Picker
const [selectedValue, setSelectedValue] = useState('');
<Picker
selectedValue={selectedValue}
style={{ height: 50, width: 150 }}
onValueChange={(itemValue, itemIndex) => setSelectedValue(itemValue)}
>
<Picker.Item label="Food" value="java" />
<Picker.Item label="Transport" value="transport" />
<Picker.Item label="Rent" value="js" />
<Picker.Item label="Other" value="other" />
</Picker>
this is my Flatlist and Button OnPress which should add this value into Flatlist
Button
title="Add me"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
<FlatList
data={data}
renderItem={({ item }) => (<Text style = {styles.item}> {item.name}</Text>)}
keyExtractor={(item, index) => index.toString()}
/>
item.name is value that i am getting from my Text INPUT, also i want to add Picker value, but couldnot solve with Picker