Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

jsamr/react-native-oneplus7-keyboard-height-discrepancy

Repository files navigation

Keyboard.addListener('keyboardDidShow', ...) callback is invoked with inaccurate measures in devices with notches on Android 10+

Incriminated API

// In Android
Keyboard.addListener('keyboardDidShow', e => {
    e.endCoordinates.height // ← On OnePlus 7, and Pixel 3XL (simulator) this value is underestimated by exactly StatusBar.currentHeight.
})

Prerequisites

In AndroidManifest.xml, set android:windowSoftInputMode="adjustPan".

Visual tests

The red vertical bar should be the same height as the keyboard. You should see a black bar at the top of the soft keyboard with a height equal to the red vertical bar width.

Remarks: In the below screenshots, the red vertical bar has been duplicated to the bottom for easy comparison of heights.

Pixel 3XL (with notch), Android 11 (emulator) Nexus 5X, Android 11 (emulator)

Run tests

You need to run the project on a device with a notch (such as Pixel 3XL).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published