Open ryancat opened 1 year ago
This is likely an issue in how PanResponder
works with useRef
. See https://snack.expo.dev/@chxryan/panresponder-caching-issue
I got inspired from https://stackoverflow.com/questions/58939572/how-to-use-panresponder-in-functional-components and tried useMemo
, and it worked.
I tried in my PR above but that is causing the slider value got reset on each re-render. I'll look into this when I have more time.
I noticed that if the component got re-rendered with a new onChange/onComplete prop, it won't be used. This is due to how the
panResponder
is created in https://github.com/sacmii/rn-vertical-slider/blob/master/src/index.tsx#L168, which is a Ref that never updates.