I\'m struggling to create a requirement for my React-Native application where I am having a blank dropbox(on dropping a flatlist item it should convert into a draggable flatlist
More performant way using declarative api from react-native-reanimated
}
/>
const GestureItem = ({item})=> {
const safex = new A.Value(0)
const safeY = new A.Value(0)
const draX = new Value(0)
const dragY = new Value(0)
const panState = new Value(State.UNDETERMINED)
const onGestureEvent = A.event([
{
nativeEvent: {
translationX: dragX,
translationY: dragY,
state: panState,
},
},
]);
const transX = cond(
eq(panState, State.ACTIVE),
dragX,
set(safeX, add(safeX, dragX))
);
const transY = cond(
eq(panState, State.ACTIVE),
dragY,
set(safeY, add(safeY, dragY))
);
return (
)
}
For swaping list items and their indexes use Code
component