TypeError: responder.scrollResponderScrollTo is not a function

Viewed 1434

In my React native expo project am facing issues with the IOS simulator and real IOS device. Actually am using React native: "0.65.1", and I tried 64.0, and 65.2 but no use.

The Error is

TypeError: responder.scrollResponderScrollTo is not a function. (In 'responder.scrollResponderScrollTo({
        x: x,
        y: y,
        animated: animated
      })', 'responder.scrollResponderScrollTo' is undefined)

after spending a few hrs I found out that this issue will come based on 'react-native-keyboard-aware-scroll-view' this npm but I haven't used it in my project. So how can we fix this issue

2 Answers

Update the following code in the /node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js file line number 244.

scrollToPosition = (x: number, y: number, animated: boolean = true) => {
  const responder = this.getScrollResponder()
  if (!responder) {
    return
  }
  if (responder.scrollResponderScrollTo) {
    // React Native < 0.65
    responder.scrollResponderScrollTo({ x, y, animated })
  } else if (responder.scrollTo) {
    // React Native >= 0.65
    responder.scrollTo({ x, y, animated })
  }
  // responder && responder.scrollResponderScrollTo({ x, y, animated })
}

scrollToEnd = (animated?: boolean = true) => {
  const responder = this.getScrollResponder()
  if (!responder) {
    return
  }
  if (responder.scrollResponderScrollTo) {
    // React Native < 0.65
    responder.scrollResponderScrollTo({ x, y, animated })
  } else if (responder.scrollTo) {
    // React Native >= 0.65
    responder.scrollTo({ x, y, animated })
  }
  // responder && responder.scrollResponderScrollToEnd({ animated })
}
Related