I have a problem , each item as a TextInput (inside the map function )->
But when I changing the value of 1 input , ALL the values are changing. any solution ??
Here is my code :
{order.currentShippingContent?.map((content, index) => {
return (
<View key={index} style={{marginTop:30}} >
<View style={{}}
<Text style={styles.materialTypeText}>{content.material}</Text>
<View>
<TextInput
style={styles.InsertAmount}
keyboardAppearance="dark"
keyboardType="number-pad"
placeholder={"type amount"}
value={input}
onChangeText={(text) => {
setInput(text);
if (Number(input) > Number(content.amount)) {
return alert("No such amount");
}
delivery.shippingContent[content.material] =
input;
}}
/>
</View>
<Text>/</Text>
<TextInput
style={styles.amountText}
placeholder={`${content.amount} `}
editable={false}
/>
</View>
</View>
);
})}