React-native-keyboard-aware-scroll-view: scrollToEnd(animate: bool) call returns undefined

Created on 12 Oct 2017  路  2Comments  路  Source: APSL/react-native-keyboard-aware-scroll-view

I tried to go to the bottom of the list using the scrollToEnd(true) function. But I got an undefined error. I tried to log the methods available on the ref by: console.log(JSON.stringify(this.refs.myRef)) and it did not have the scrollToEnd method.

Was this removed from the API ? Here is what I am trying to do:

<KeyboardAwareScrollView
    backgroundColor="#f7f7f7"
    ref="myRef"
    enableOnAndroid
 >
    // another view
 </KeyboardAwareScrollView>

and then in my another function I call:

scrollToEnd() {
    this.refs.myRef && this.refs.myRef.scrollToEnd(true)
  }

Right now I have a temporary fix: this.refs.myRef.scrollToPosition(10000000, 10000000, true)

Version: 0.2.7
Node: 6.2.1
react-native-cli: 2.0.1
react-native: 0.33.0

All 2 comments

Please try the newer version, 0.4.0. You must access these methods on this.scrollView.props, and then:

this.scroll.props.scrolToEnd(true)

It is not working on android.

Was this page helpful?
0 / 5 - 0 ratings