Fire onScroll from props in KeyboardAwareScrollView.
💡 Motivation and Context
Initially I wanted to achieve that as runOnJS(props.onScroll)({ nativeEvent: e }). But in this case I'm getting:
Argument of type '{ nativeEvent: ReanimatedScrollEvent; }' is not assignable to parameter of type 'NativeSyntheticEvent<NativeScrollEvent>'.
Type '{ nativeEvent: ReanimatedScrollEvent; }' is missing the following properties from type 'NativeSyntheticEvent<NativeScrollEvent>': currentTarget, target, bubbles, cancelable, and 10 more.ts(2345)
And it's really incorrect, because several properties will be missing and js-based handler (not based on Animated.event) may not read expected properties (such as target etc.).
So I wanted to pass onScroll handler from reanimated as onScrollReanimated property. In this case onScroll will be passed from rest props and will be fired correctly.
📜 Description
Fire
onScroll
from props inKeyboardAwareScrollView
.💡 Motivation and Context
Initially I wanted to achieve that as
runOnJS(props.onScroll)({ nativeEvent: e })
. But in this case I'm getting:And it's really incorrect, because several properties will be missing and js-based handler (not based on
Animated.event
) may not read expected properties (such astarget
etc.).So I wanted to pass
onScroll
handler from reanimated asonScrollReanimated
property. In this caseonScroll
will be passed fromrest
props and will be fired correctly.Closes https://github.com/kirillzyusko/react-native-keyboard-controller/issues/337
📢 Changelog
JS
onScroll
(asrest
) toScrollView
.🤔 How Has This Been Tested?
Tested manually on iPhone 15 Pro.
📝 Checklist