diff --git a/lib/KeyboardAwareHOC.js b/lib/KeyboardAwareHOC.js index 4bf0ed0..f682f1a 100644 --- a/lib/KeyboardAwareHOC.js +++ b/lib/KeyboardAwareHOC.js @@ -362,7 +362,6 @@ function KeyboardAwareHOC( // Keyboard actions _updateKeyboardSpace = (frames: Object) => { // Automatically scroll to focused TextInput - if (this.props.enableAutomaticScroll) { let keyboardSpace: number = frames.endCoordinates.height + this.props.extraScrollHeight if (this.props.viewIsInsideTabBar) { @@ -392,7 +391,7 @@ function KeyboardAwareHOC( textInputBottomPosition > keyboardPosition - totalExtraHeight ) { - this._scrollToFocusedInputWithNodeHandle( + this.props.enableAutomaticScroll && this._scrollToFocusedInputWithNodeHandle( currentlyFocusedField ) } @@ -406,13 +405,13 @@ function KeyboardAwareHOC( keyboardSpace = keyboardSpace - (textInputBottomPosition - keyboardPosition) - this.setState({ keyboardSpace }) - this.scrollForExtraHeightOnAndroid(totalExtraHeight) + // TODO: this wasn't working for castle: this.setState({ keyboardSpace }) + this.props.enableAutomaticScroll && this.scrollForExtraHeightOnAndroid(totalExtraHeight) } else if ( textInputBottomPosition > keyboardPosition - totalExtraHeight ) { - this.scrollForExtraHeightOnAndroid( + this.props.enableAutomaticScroll && this.scrollForExtraHeightOnAndroid( totalExtraHeight - (keyboardPosition - textInputBottomPosition) ) @@ -423,7 +422,7 @@ function KeyboardAwareHOC( } } ) - } + if (!this.props.resetScrollToCoords) { if (!this.defaultResetScrollToCoords) { this.defaultResetScrollToCoords = this.position diff --git a/package.json b/package.json index e5f3045..37d4bfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "react-native-keyboard-aware-scroll-view", - "version": "0.9.1", + "name": "@castle-games/react-native-keyboard-aware-scroll-view", + "version": "0.9.2", "description": "A React Native ScrollView component that resizes when the keyboard appears.", "main": "index.js", "types": "index.d.ts",