I have a flatlist. The flatlist contains todos that I can add, edit and delete. I have two buttons on each todo-item, one for up and one for down.
If I want to push them up 1 step (until it reaches 0) or down (until it reaches the last item) how would I do this? Help is much appreciated, this feels basic but I can't seem to find an answer that works. Here is my code:
<FlatList
removeClippedSubviews={false}
data = {todos.sort(function(a,b){return b.date - a.date})}
keyExtractor={(item)=>item.key}
renderItem={({item})=>{
return(
<TouchableOpacity>
<View>
<TextInput
style={styles.toDoItem}
value={item.title}
onChangeText={(text)=>handleUpdateText(text, item)}
multiline={true}
maxLength={55}
blurOnSubmit={true}
/>
<TouchableOpacity onPress={()=>handleMoveUp(item.key, item)}>
<FontAwesome name="plus-circle" size={30} color={black}/>
</TouchableOpacity>
<TouchableOpacity onPress={()=>handleMoveDown(item.key, item)}>
<FontAwesome name="minus-circle" size={50} color={black}/>
</TouchableOpacity>