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

InteractionManager.runAfterInteractions not running after using RangeSlider component #146

Open
gobzila opened this issue Jul 3, 2023 · 1 comment

Comments

@gobzila
Copy link

gobzila commented Jul 3, 2023

Description

InteractionManager.runAfterInteractions's callback is not called after RangeSlider component is rendered at least once.

Version

2.2.2

Steps to reproduce

  1. Render RangeSlider component.
  2. Use InteractionManager.runAfterInteractions(callback). It doesn't matter if RangeSlider is unmounted or not.
  3. InteractionManager.runAfterInteractions's callback is not called.

Cause

The package uses PanResponder which holds an InteractionManager handle to block long-running JS events from interrupting active gestures. Basically blocks all InteractionManager.runAfterInteractions's callbacks until the interaction handle is cleared.

In this package PanResponder's instance is created using useMemo and is re-created during each ongoing gesture (because its dependencies change) which causes the interaction handle's reference to be orphaned without being cleared.

Solution

Switch from useMemo to useRef as shown in React Native docs (https://reactnative.dev/docs/panresponder#usage-pattern).

@rick-nice
Copy link

rick-nice commented Aug 25, 2023

(#150) Fixed this problem here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants