Skip to content

Keyboard height is wrong on some android devices (causing the keyboard to show over text inputs) #26461

Closed
@vandrieu

Description

@vandrieu

When the keyboard is show, the 'keyboardDidShow' event is fired.

We listen to it like this:

Keyboard.addListener('keyboardDidShow', this.handleKeyboardDidShow)

When it's fired, we start an Animated.Value that goes from 0 to -keyboardHeight to move the main view up (there are better ways to handle it, but that's not the point, I'm just trying to keep it simple here)

handleKeyboardDidShow = (event) => {
	Animated.timing(
		this.state.moveUpValue,
		{
			toValue: -event.endCoordinates.height,
			duration: 200,
			easing: Easing.linear
		}
	).start();
}

The main view is like:

<Animated.View style={{ transform: [{ translateY: this.state.moveUpValue }] }}>
</Animated.View>

It works on all iOS devices and it works on most Android devices, but on some Android devices, the event.endCoordinates.height value is wrong, causing the text input to be partially hidden.

This is a Huawei P20 Pro:

IMG-20190425-WA0006

This is a Samsung A40:

IMG-20190916-WA0001

How are we supposed to deal with that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: KeyboardBugPlatform: AndroidAndroid applications.Ran CommandsOne of our bots successfully processed a command.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions