I am creating a flat list where I need to submit an API with some request options on each item click. After a successful API response, I must show a green tick for that particular flatlist item.
renderItem
const Item = ({item, onPress, backgroundColor, textColor}) => (
<TouchableOpacity onPress={onPress} style={backgroundColor}>
<View style={{flexDirection: 'row', width: '100%'}}>
<Text style={textColor}>{item?.name}</Text>
<Image
source={Images.greenTick}
style={{
width: 20,
height: 20,
}}></Image>
</View>
</TouchableOpacity>
);
Here, I am not sure how can I manage the image to be shown in renderItem after API success at a specific index or multiple indexes one by one.
I think you will have to track the clicked item first by maintaining a state. I have tried it in my app once. you can refer to a sample code below