-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tried to modify key current
of an object which has been already passed to a worklet. See
#557
Comments
current
of an object which has been already passed to a worklet. Seecurrent
of an object which has been already passed to a worklet. See
Same issue here this happens on TouchableOpacity in renderItem |
Also ran into this after updating to reanimated 3.15.5 and react native 0.75 |
Facing the same issue here |
Same here |
this is still an issue on the latest reanimated |
same here with expo 52 |
facing same issue here too
|
same here with expo 51 |
I have the same problem. Is there any workaround by now? |
I Have the same issue and the ScaleDecorator specifically triggers a repetitive cascade of the same warning while the item is being dragged without the ScaleDecorator the warning is triggered only upon completion and screen render
|
I'm pretty sure The issue is within the KeyExtractor in the DraggableFlatList component. as it joins the index to the key provided so everytime an item is adjusted in the list the warning fires because the index is changing and changing the key. |
this is not best practice but
|
Try this import { configureReanimatedLogger({ This sets it so only errors will be rendered. Though it's not an ideal work around |
"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. Seehttps://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) => {
return (
<TouchableOpacity
onLongPress={drag}
disabled={isActive}
style={[
styles.rowItem,
{
backgroundColor: isActive ? 'red' : item.backgroundColor,
},
]}>
{item.label}
);
};
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',
},
];
The text was updated successfully, but these errors were encountered: