Skip to content
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

ReanimatedSwipeable Error: Tried to modify key velocity of an object which has already passed to a worklet #3080

Closed
ucheNkadiCode opened this issue Aug 31, 2024 · 3 comments
Labels
Missing repro Platform: iOS This issue is specific to iOS

Comments

@ucheNkadiCode
Copy link

ucheNkadiCode commented Aug 31, 2024

Description

I changed from the Swipeable Object to the ReanimatedObject because Swipeable has been deprecated in gesture handler

Steps to reproduce

My code (abbreviated)

import Swipeable, {
  SwipeableMethods,
} from "react-native-gesture-handler/ReanimatedSwipeable";

export const NoteRow: React.FC<NoteRowProps> = 
  ({
... 
const swipeableRef = useRef<SwipeableMethods | null>(null);
    const openCardActions = useCallback(() => {
      swipeableRef.current?.openRight();
    }, []);
    const closeCardActions = useCallback(() => {
      swipeableRef.current?.close();
    }, []);

 <Swipeable
          ref={(ref) => (swipeableRef.current = ref)}
          renderRightActions={renderRightActions}
          onBegan={() => {
            console.log(`On began`);
            handleSwipe(
              queueItemID ? queueItemID : workoutToShow.workoutID,
              typeof cardIndex === "number" ? cardIndex : undefined
            );
          }}
          rightThreshold={ScreenUtils.getWidth() * 0.1}
          enabled={enableSwipe}
        >
...
</Swipeable

With this warning - react native points to this file -> ReanimatedSwipeable.tsx

// Velocity is in px, while progress is in %
        springConfig.velocity = 0;

in the const animateRow = useCallback( function. My workaround was reverting back to the deprecated Swipeable

Snack or a link to a repository

don't have a link

Gesture Handler version

^2.18.1

React Native version

0.75.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

None

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added Missing repro Platform: iOS This issue is specific to iOS labels Aug 31, 2024
@j-piasecki
Copy link
Member

This problem should be fixed by #3045. Please update to React Native Gesture Handler 2.19.0.

@ucheNkadiCode
Copy link
Author

As always, thank you so much for the work y'all do ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro Platform: iOS This issue is specific to iOS
Projects
None yet
Development

No branches or pull requests

2 participants