Closed JaxGit closed 7 years ago
Solution: For any major version of react-native-keyboard-spacer, use this:
updateKeyboardSpace(frames) {
if (!frames.endCoordinates) {
return;
}
// get updated on rotation
const screenHeight = Dimensions.get('window').height;
// when external physical keyboard is connected
// frames.endCoordinates.height still equals virtual keyboard height
// however only the keyboard toolbar is showing if there should be one
const keyboardSpace = (screenHeight - frames.endCoordinates.screenY) + this.props.topSpacing;
this.setState({
keyboardSpace,
isKeyboardOpened: true
}, this.props.onToggle(true, keyboardSpace));
}
Fix for latest version is in PR https://github.com/Andr3wHur5t/react-native-keyboard-spacer/pull/31
Nice catch, will verify fix / review PR when I get back to my machine.
Actual result: The keyboardSpace is taking too much when external physical keyboard is connected.
External physical keyboard could be simulated as well with the following method:
Reason: frames.endCoordinates deviation from screenHeight does not necessarily equal to virtual keyboard height. When external physical keyboard is connected, only the keyboard toolbar is showing if there should be one. The keyboard frame is located offscreen and could be glimpsed only during rotation.