React-native-keyboard-aware-scroll-view: react-native 0.63 scrollIntoView of undefined

Created on 2 Sep 2020  路  3Comments  路  Source: APSL/react-native-keyboard-aware-scroll-view

When I run scrollToEnd in version 0.63, I get the error scrollIntoView of undefined.

also now scroll.props.scrollToEnd gives an error. Because there are no props.

this.scroll.props.scrollToEnd(); // Change to this.scroll.scrollToEnd();

Warning:

TypeError: Cannot read property 'scrollIntoView' of undefined

this is a warning But it doesn't scroll down.

Thanks.

Most helpful comment

@nhatndm I was able to achieve this in more accurate way:

<KeyboardAwareScrollView
      innerRef={(ref) => { this.scrollView = ref.getScrollResponder(); }}
/>
const _scrollToInput = (reactNode: ReactNode) => {
     this.scrollView.props.scrollToFocusedInput(inputNode, 200);
};

All 3 comments

Hi,

Any updates on this ?

Thanks!!

@Foskas , after working around, here is my solution how can call these functions scrollToEnd, scrollIntoView,.. for functional component

let scrollProps;
<KeyboardAwareScrollView
      innerRef={(ref) => {
        scrollProps = ref._internalFiberInstanceHandleDEV.memoizedProps;
      }}
/>
const _scrollToInput = (reactNode: ReactNode) => {
   // 200 is extra height after scrolling to component
    scrollProps.scrollToFocusedInput(reactNode, 200);
  };
<TextInput  onFocus={(event) => _scrollToInput(findNodeHandle(event.target))} />

@nhatndm I was able to achieve this in more accurate way:

<KeyboardAwareScrollView
      innerRef={(ref) => { this.scrollView = ref.getScrollResponder(); }}
/>
const _scrollToInput = (reactNode: ReactNode) => {
     this.scrollView.props.scrollToFocusedInput(inputNode, 200);
};
Was this page helpful?
0 / 5 - 0 ratings