software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

Warning when closing Reanimated Swipeable #3044

Closed atheck closed 3 months ago

atheck commented 3 months ago

Description

I use the new Reanimated version of the Swipeable component. When I call close() on the ref, a warning is shown:

screenshot-1723548719660

Steps to reproduce

const swipeableRef = useRef<SwipeableMethods>(null);

const renderRightActions = () => {
  return (
    <IconButton
      onPress={() => {
        swipeableRef.current?.close();
        onPress();
      }}
    />
  );
};

return <Swipeable
  ref={swipeableRef}
  renderRightActions={renderRightActions}
/>

Snack or a link to a repository

See Steps to reproduce

Gesture Handler version

2.18.1

React Native version

0.73.9

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Real device

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 3 months ago

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?

latekvo commented 3 months ago

Hey @atheck, thank you for reporting this issue.

Could you please let me know if this PR resolves your issue?

I couldn't reproduce this error with the code you provided, if you were to continue to encounter this issue, could you please provide us with an independently working reproduction code? It looks like the fragment you provided is an extract from a larger component.

atheck commented 3 months ago

Many thanks for the quick response. I'll give it a try.

Yes indeed, the code I provided is a fragment of a larger component. I tried to create a snack, but I didn't get it to work with current versions of the packages "react-native-gesture-handler" and "react-native-reanimated".

If your PR is not working for me I try to create a working reproduction.

atheck commented 3 months ago

It works, no warning anymore. Thank you @latekvo!

rifad4u commented 3 months ago

@latekvo I'm also facing this warning when closing a row. Please make the PR live.