From 997307cc38f0f9ab6207e00c819feb368f73e533 Mon Sep 17 00:00:00 2001 From: Lowell List Date: Thu, 4 Oct 2018 11:51:33 -0700 Subject: [PATCH 1/2] add forceKeyboardHeightToZero prop --- src/GiftedChat.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GiftedChat.js b/src/GiftedChat.js index 4f8e8438d..d9197bf45 100644 --- a/src/GiftedChat.js +++ b/src/GiftedChat.js @@ -171,6 +171,10 @@ class GiftedChat extends React.Component { } getKeyboardHeight() { + // if true, then always force keyboard height to zero + if (this.props.forceKeyboardHeightToZero) { + return 0; + } if (Platform.OS === 'android' && !this.props.forceGetKeyboardHeight) { // For android: on-screen keyboard resized main container and has own height. // @see https://developer.android.com/training/keyboard-input/visibility.html @@ -556,6 +560,7 @@ GiftedChat.defaultProps = { onInputTextChanged: null, maxInputLength: null, forceGetKeyboardHeight: false, + forceKeyboardHeightToZero: false, inverted: true, }; @@ -605,6 +610,7 @@ GiftedChat.propTypes = { onInputTextChanged: PropTypes.func, maxInputLength: PropTypes.number, forceGetKeyboardHeight: PropTypes.bool, + forceKeyboardHeightToZero: PropTypes.bool, inverted: PropTypes.bool, textInputProps: PropTypes.object, }; From 962ae8104ac47f1ed79f0703ed9912f762dcd147 Mon Sep 17 00:00:00 2001 From: Lowell List Date: Thu, 4 Oct 2018 12:12:47 -0700 Subject: [PATCH 2/2] rename prop; add description to README --- README.md | 1 + src/GiftedChat.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd85c7e9d..bbfad328d 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ e.g. System Message ]} /> ``` +* **`disableKeyboardAvoiding`** _(Bool)_ - If true, do not adjust for the onscreen keyboard. Useful if you're managing keyboard avoidance yourself. ## Imperative methods diff --git a/src/GiftedChat.js b/src/GiftedChat.js index d9197bf45..b79e608ff 100644 --- a/src/GiftedChat.js +++ b/src/GiftedChat.js @@ -172,7 +172,7 @@ class GiftedChat extends React.Component { getKeyboardHeight() { // if true, then always force keyboard height to zero - if (this.props.forceKeyboardHeightToZero) { + if (this.props.disableKeyboardAvoiding) { return 0; } if (Platform.OS === 'android' && !this.props.forceGetKeyboardHeight) { @@ -560,7 +560,7 @@ GiftedChat.defaultProps = { onInputTextChanged: null, maxInputLength: null, forceGetKeyboardHeight: false, - forceKeyboardHeightToZero: false, + disableKeyboardAvoiding: false, inverted: true, }; @@ -610,7 +610,7 @@ GiftedChat.propTypes = { onInputTextChanged: PropTypes.func, maxInputLength: PropTypes.number, forceGetKeyboardHeight: PropTypes.bool, - forceKeyboardHeightToZero: PropTypes.bool, + disableKeyboardAvoiding: PropTypes.bool, inverted: PropTypes.bool, textInputProps: PropTypes.object, };