Skip to content
Discussion options

You must be logged in to vote

In the end I got this working by using the 'enabled' property of the gesture handler:

const MyComponent = React.memo((props: Props) => {
  const [enabled, setEnabled] = useState(true);

  const gestureHandler = useAnimatedGestureHandler({
    onStart: (event, context) => {
      if ([condition is successfully met]) {
        
      } else {
        runOnJS(setEnabled)(false);
      }
    },
    onActive: (event, context) => {
      console.log('event active');
    },
    onEnd: (event, context) => {
      console.log('event end');
    },
    onFail: (event, context) => {
      console.log('event fail');
    },
    onCancel: (event, context) => {
      console.log('event cancel');
    },
 …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dpyeates
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dpyeates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants