react-native-slider icon indicating copy to clipboard operation
react-native-slider copied to clipboard

fix: separate the internal ref from the external one for correct operation of `useImperativeHandle` and `getBoundingClientRect`

Open exzos28 opened this issue 2 months ago • 1 comments

Summary:

  1. 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.

  1. Fix updateValue via ref - always call the onValueChange callback.

Test Plan:

I've create an ControlledSliderExample in src/Examples:

https://github.com/user-attachments/assets/495c8997-3e62-4cbb-b9d5-3f67fa412ebe

exzos28 avatar Oct 14 '25 13:10 exzos28

anyone?

exzos28 avatar Oct 22 '25 14:10 exzos28