From abb65309d33462bdaaa1613c63fbbbbffe2257b2 Mon Sep 17 00:00:00 2001 From: mdobroggg <49248129+mdobroggg@users.noreply.github.com> Date: Fri, 29 May 2020 14:51:23 -0400 Subject: [PATCH 1/2] Fix type error when navigating with the keyboard open Navigating with react navigation with the keyboard open causes this to throw an error. This simple fix will resolve that. --- src/KeyboardAwareBase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KeyboardAwareBase.js b/src/KeyboardAwareBase.js index fb1c58ac..9874db0f 100644 --- a/src/KeyboardAwareBase.js +++ b/src/KeyboardAwareBase.js @@ -111,7 +111,7 @@ export default class KeyboardAwareBase extends Component { const hasYOffset = this._keyboardAwareView && this._keyboardAwareView.contentOffset && this._keyboardAwareView.contentOffset.y !== undefined; const yOffset = hasYOffset ? Math.max(this._keyboardAwareView.contentOffset.y - keyboardHeight, 0) : 0; - this._keyboardAwareView.scrollTo({x: 0, y: yOffset, animated: true}); + this._keyboardAwareView?.scrollTo({x: 0, y: yOffset, animated: true}); } scrollBottomOnNextSizeChange() { From 9dc2a7e2094117edd12a2b1940e3b0dc6099430a Mon Sep 17 00:00:00 2001 From: mdobroggg <49248129+mdobroggg@users.noreply.github.com> Date: Fri, 29 May 2020 15:07:16 -0400 Subject: [PATCH 2/2] Update KeyboardAwareBase.js --- src/KeyboardAwareBase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KeyboardAwareBase.js b/src/KeyboardAwareBase.js index 9874db0f..f8a82cf7 100644 --- a/src/KeyboardAwareBase.js +++ b/src/KeyboardAwareBase.js @@ -111,7 +111,7 @@ export default class KeyboardAwareBase extends Component { const hasYOffset = this._keyboardAwareView && this._keyboardAwareView.contentOffset && this._keyboardAwareView.contentOffset.y !== undefined; const yOffset = hasYOffset ? Math.max(this._keyboardAwareView.contentOffset.y - keyboardHeight, 0) : 0; - this._keyboardAwareView?.scrollTo({x: 0, y: yOffset, animated: true}); + this?._keyboardAwareView?.scrollTo({x: 0, y: yOffset, animated: true}); } scrollBottomOnNextSizeChange() {