Skip to content

Commit

Permalink
Merge pull request #3 from maxiru/fix/KeyboardSpacerMultiline-1
Browse files Browse the repository at this point in the history
Update when topSpacing prop is changed
  • Loading branch information
SnaiNeR authored Jun 10, 2020
2 parents cfe6e03 + ee6edd3 commit 233b047
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions KeyboardSpacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -135,6 +135,17 @@ export default class KeyboardSpacer extends Component {

render() {
return (
<View style={[styles.container, { height: this.state.keyboardSpace }, this.props.style]} />);
<View
style={[
styles.container,
{
height:
this.state.keyboardSpace +
(this.state.isKeyboardOpened ? this.props.topSpacing : 0)
},
this.props.style
]}
/>
);
}
}

0 comments on commit 233b047

Please sign in to comment.