react-native-keyboard-aware-scroll-view
react-native-keyboard-aware-scroll-view copied to clipboard
Methods missing from innerRef
The approach used in the documentation returns a reference in which this.scroll.props results in undefined meaning that we cannot use the scrollToPosition, scrollIntoView or, getScrollResponder methods.
scrollToEnd however can in fact be accessed directly from the reference i.e this.scroll.scrollToEnd()
I found a little workaround. So instead of this:
const myRef = useRef(null);
useEffect(() => {
myRef.current.props.scrollToPosition(x, y, true);
}, [x, y])
return (
<KeyboardAwareScrollView innerRef={myRef} />
);
You can use
const myRef = useRef(null);
useEffect(() => {
myRef.current.scrollToPosition(x, y, true);
}, [x, y])
return (
<KeyboardAwareScrollView ref={myRef} />
);
However it's not documented so I have no clue what's going to be supported in the future
I have the same issue
I have the same issue when using scrollToIndex
in KeyboardAwareFlatList.
Biggest problem is TypeScript yells about: Property 'scrollIntoView' does not exist on type 'KeyboardAwareScrollView'.