Open yarelosa opened 5 months ago
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
@codler/react-native-keyboard-aware-scroll-view@1.0.1
for the project I'm working on.Here is the diff that solved my problem:
diff --git a/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js b/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js index 855c968..a16719d 100644 --- a/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js +++ b/node_modules/@codler/react-native-keyboard-aware-scroll-view/lib/KeyboardAwareHOC.js @@ -241,12 +241,32 @@ function KeyboardAwareHOC( scrollToPosition = (x: number, y: number, animated: boolean = true) => { const responder = this.getScrollResponder() - responder && responder.scrollResponderScrollTo({ x, y, animated }) - } + 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) => { + scrollToEnd = (animated?: boolean = true) => { const responder = this.getScrollResponder() - responder && responder.scrollResponderScrollToEnd({ animated }) + 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 }) } scrollForExtraHeightOnAndroid = (extraHeight: number) => {
This issue body was partially generated by patch-package.
can you make a fork?
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
@codler/react-native-keyboard-aware-scroll-view@1.0.1
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.