Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions KeyboardSpacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class KeyboardSpacer extends Component {
}

componentDidMount() {
const updateListener = Platform.OS === 'android' ? 'keyboardDidShow' : 'keyboardWillShow';
const updateListener = Platform.OS === 'android' ? 'keyboardDidShow' : 'keyboardWillChangeFrame';
const resetListener = Platform.OS === 'android' ? 'keyboardDidHide' : 'keyboardWillHide';
this._listeners = [
Keyboard.addListener(updateListener, this.updateKeyboardSpace),
Expand Down Expand Up @@ -91,7 +91,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 All @@ -116,7 +116,8 @@ export default class KeyboardSpacer extends Component {
}

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