From ee6edd3001394a19e83395c57b81978e98b3e53f Mon Sep 17 00:00:00 2001
From: Artem <39980963+SnaiNeR@users.noreply.github.com>
Date: Wed, 10 Jun 2020 14:28:15 +0500
Subject: [PATCH] Update when topSpacing prop is changed
https://github.com/Andr3wHur5t/react-native-keyboard-spacer/pull/56
A fix for #49. I tried to avoid manually writing a componentWillReceiveProps function to keep the code simpler.
---
KeyboardSpacer.js | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/KeyboardSpacer.js b/KeyboardSpacer.js
index 4d5e0ac..beffb40 100644
--- a/KeyboardSpacer.js
+++ b/KeyboardSpacer.js
@@ -105,7 +105,7 @@ export default class KeyboardSpacer extends Component {
// when external physical keyboard is connected
// event.endCoordinates.height still equals virtual keyboard height
// however only the keyboard toolbar is showing if there should be one
- const keyboardSpace = (screenHeight - event.endCoordinates.screenY) + this.props.topSpacing;
+ const keyboardSpace = screenHeight - event.endCoordinates.screenY;
this.setState({
keyboardSpace,
isKeyboardOpened: true
@@ -135,6 +135,17 @@ export default class KeyboardSpacer extends Component {
render() {
return (
- );
+
+ );
}
}