react-native-draggable-flatlist icon indicating copy to clipboard operation
react-native-draggable-flatlist copied to clipboard

Tried to modify key `current` of an object which has been already passed to a worklet. See

Open rohanthakran opened this issue 4 months ago • 2 comments

"react-native-reanimated": "^3.15.5", "react-native-gesture-handler": "^2.20.0", "react-native-draggable-flatlist": "^4.0.1",

[Reanimated] Tried to modify key current of an object which has been already passed to a worklet. See

https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#tried-to-modify-key-of-an-object-which-has-been-converted-to-a-shareable for more details.

This is the code <DraggableFlatList activationDistance={5} data={dragData} onDragEnd={({data}) => setDragData(data)} keyExtractor={item => item.key} renderItem={renderItemDrag} containerStyle={[{backgroundColor: 'pink'}]} />

const renderItemDrag = ({item, drag, isActive}: RenderItemParams<Item>) => { return ( <ScaleDecorator> <TouchableOpacity onLongPress={drag} disabled={isActive} style={[ styles.rowItem, { backgroundColor: isActive ? 'red' : item.backgroundColor, }, ]}> <Text style={styles.text}>{item.label}</Text> </TouchableOpacity> </ScaleDecorator> ); };

const initialData = [ { label: '🍎 Apple', key: 'apple', backgroundColor: 'indianred', }, { label: '🍊 Orange', key: 'orange', backgroundColor: 'orange', }, { label: '🍌 Banana', key: 'banana', backgroundColor: 'yellowgreen', }, { label: '🍇 Grapes', key: 'grapes', backgroundColor: 'purple', }, ];

rohanthakran avatar Oct 14 '24 09:10 rohanthakran