HomePhabricator
Diffusion Comm 14f44e8ce8a8

[native] Temporary fix for not opening FullScreenViewModal on Android

Description

[native] Temporary fix for not opening FullScreenViewModal on Android

Summary:
https://linear.app/comm/issue/ENG-10294/cant-open-fullscreenviewmodal-second-time-on-android-cant-cancel

this issue affects only some Android devices. I can reproduce it on Pixel 8 API 35 emulator, but I can't reproduce it on my Xperia 10 III. Probably it reproduces on devices with bigger notches.

FullScreenViewModal hides a status bar when it appears:

const statusBar = isActive ? <ConnectedStatusBar hidden /> : null;

RN calculates whether keyboard appears or not based on window height, root view height and notch height: https://github.com/facebook/react-native/blob/v0.70.15/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java#L915

When status bar disappears, notch has height = 0 and RN thinks the keyboard disappeared and sends keyboardDidHide event.

When modal is closed, notch has more height and RN thinks the keyboard appears and sends keyboardDidShow event.

Because of keyboardDidShow event, in KeyboardStateContainer systemKeyboardShowing is true, even though there is no keyboard visible. When clicking on a message with an image, there is a check: https://github.com/CommE2E/comm/blob/ce89bf928cc18a2c6d9919174d3089a4bd66f991/native/chat/multimedia-message-multimedia.react.js#L80

if (dismissKeyboardIfShowing()) {
   return;
}

Because the keyboard is already hidden, dismissing it doesn't do anything and systemKeyboardShowingstays true and the modal doesn't appear again.

I've made a snack that reproduces this: https://snack.expo.dev/@angelika_serwa/moody-orange-carrot
If you run this snack on affected device with RN 0.70 version the alerts will appear even though there is no keyboard visible.
On RN 76 (default snack version) it looks like it's fixed, so it's possible the newer versions of RN fixed this.

This is a temporary solution: don't hide status bar on android.

Test Plan: Open and close FullScreenViewModal on affected devices a couple of times

Reviewers: tomek

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D14430

Details

Provenance
angelikaAuthored on Wed, Mar 5, 2:26 AM
Reviewer
tomek
Differential Revision
D14430: [native] Temporary fix for not opening FullScreenViewModal on Android
Parents
rCOMM0f2665625267: [native] cache LoadableImage in memory and disk
Branches
Loading...
Tags
Loading...