react-native-bottom-sheet
react-native-bottom-sheet copied to clipboard
How do we attach onScroll to an animated event?
I want to animate my header while the list inside the bottom panle is being scrolled. With the earlier library I was simply attaching the onScroll event of the panel to the AnimatedEvent, but with this library on v4 when I try to do that I get an error of runOnJS, saying attempt to call runOnJs with an object that is not a host function.
Is there some other way to achieve, I couldn't really find anything about this, so if anyone can help me out.
This is what I want to do onScroll, basically capture the scrollY position and use that to update my variable which in turn animates my header.
onScroll = Animated.event([
{
nativeEvent: {
contentOffset: {
y: this.scrollPosition,
},
},
},
])
@saransh-malik: hello! :wave:
This issue is being automatically closed because it does not follow the issue template.
I think this is because of runOnJS
here https://github.com/gorhom/react-native-bottom-sheet/blob/cebae97c56f0b2ff31c247b1fce5cbe8172b6554/src/hooks/useScrollHandler.ts#L39
Here is a little explanation: https://github.com/gorhom/react-native-bottom-sheet/pull/952#issuecomment-1161614075
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.