'this.scrollView.getNode is not a function

node_modules/react-native-scrollable-tab-view/index.js

goToPage(pageNumber) {
if (Platform.OS === 'ios') {
  const offset = pageNumber * this.state.containerWidth;
  if (this.scrollView) {
    this.scrollView
    .getNode()
    .scrollTo({x: offset, y: 0, animated: !this.props.scrollWithoutAnimation, });
  }
} else {
  if (this.scrollView) {
    if (this.props.scrollWithoutAnimation) {
      this.scrollView.getNode().setPageWithoutAnimation(pageNumber);
    } else {
      this.scrollView
      .getNode()
      .setPage(pageNumber);
    }
  }
}

just comment the getNode()

goToPage(pageNumber) {
if (Platform.OS === 'ios') {
  const offset = pageNumber * this.state.containerWidth;
  if (this.scrollView) {
    this.scrollView
  //  .getNode()
    .scrollTo({x: offset, y: 0, animated: !this.props.scrollWithoutAnimation, });
  }
} else {
  if (this.scrollView) {
    if (this.props.scrollWithoutAnimation) {
      this.scrollView.getNode().setPageWithoutAnimation(pageNumber);
    } else {
      this.scrollView
    //  .getNode()
      .setPage(pageNumber);
    }
  }
}

it works but next time when we restart again node_modules not update your changes you make in (like commenting on removing getNode()), so use https://www.npmjs.com/package/patch-package for permanent changes

right now this is the only solution



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source