Computer Programming/React-Native

React-Native Error Case(firebase, responder.scrollResponderScrollTo)

JYCoder 2022. 8. 27. 04:07

Error Message

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

Solution

I got this error once I try to connect to firebase to implement the signIn function.

And I got the solution from the link at:

https://stackoverflow.com/questions/71709482/typeerror-responder-scrollresponderscrollto-is-not-a-function

 

In my case, I edited the two functions as below.

You can find the file at '/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js file'.

 

singIn 기능 구현을 위해 firebase에 연결하는 과정에서 위와 같은 에러가 떴다.

이에 대한 해결책을 위에 있는 링크를 통해 찾았다.

나의 경우, 두 가지 함수를 수정하였더니 에러가 해결되었다.

수정할 파일의 위치는 위에 적어두었다.

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

 

 

LIST