Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native 0.63 scrollIntoView of undefined #451

Open
yasaricli opened this issue Sep 2, 2020 · 4 comments · May be fixed by #462
Open

react-native 0.63 scrollIntoView of undefined #451

yasaricli opened this issue Sep 2, 2020 · 4 comments · May be fixed by #462

Comments

@yasaricli
Copy link

yasaricli commented Sep 2, 2020

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.

yskoht added a commit to newn-team/react-native-keyboard-aware-scroll-view that referenced this issue Sep 8, 2020
@Foskas
Copy link

Foskas commented Oct 22, 2020

Hi,

Any updates on this ?

Thanks!!

@yasaricli yasaricli linked a pull request Oct 22, 2020 that will close this issue
moriyuu added a commit to newn-team/react-native-keyboard-aware-scroll-view that referenced this issue Nov 10, 2020
@nhatndm
Copy link

nhatndm commented Dec 6, 2020

@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))} />

@olegmilan
Copy link

@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);
};

@arstropica
Copy link

@olegmilan
I modified this to allow for instance removal:

<KeyboardAwareScrollView
      innerRef={(ref) => { this.scrollView = ref ? ref.getScrollResponder() : null; }}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants