react-native-slider
react-native-slider copied to clipboard
fix: separate the internal ref from the external one for correct operation of `useImperativeHandle` and `getBoundingClientRect`
Summary:
- Passing a ref causes a crash in the web:
Here, a single ref is used both for working with useImperativeHandle and for obtaining the position via getBoundingClientRect.
However, when calling getBoundingClientRect, the ref does not exist. It is likely that the implementation of useImperativeHandle has changed in React19 and its createHandle callback overrides current.
- Fix
updateValuevia ref - always call theonValueChangecallback.
Test Plan:
I've create an ControlledSliderExample in src/Examples:
https://github.com/user-attachments/assets/495c8997-3e62-4cbb-b9d5-3f67fa412ebe
anyone?