Page MenuHomePhabricator

[native] Temporary fix for not opening FullScreenViewModal on Android
AcceptedPublic

Authored by angelika on Wed, Mar 5, 2:28 AM.
Tags
None
Referenced Files
F4893165: D14430.id47364.diff
Wed, Mar 12, 7:21 PM
F4889096: D14430.id.diff
Wed, Mar 12, 1:28 PM
F4888613: D14430.id.diff
Wed, Mar 12, 11:06 AM
Unknown Object (File)
Wed, Mar 12, 1:31 AM
Unknown Object (File)
Tue, Mar 11, 4:08 PM
F4800078: Screenshot 2025-03-10 at 15.05.56.png
Mon, Mar 10, 7:07 AM
Unknown Object (File)
Mon, Mar 10, 12:06 AM
Unknown Object (File)
Sun, Mar 9, 5:51 PM
Subscribers

Details

Reviewers
tomek
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

Diff Detail

Repository
rCOMM Comm
Branch
graszka22/ENG-10294
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

angelika held this revision as a draft.
angelika published this revision for review.Wed, Mar 5, 2:33 AM

How does the app look like with a modal and the status bar visible?

native/components/full-screen-view-modal.react.js
723–724

We should create a task and add it to the project so that we don't forget about it.

This revision is now accepted and ready to land.Mon, Mar 10, 1:54 AM

How does the app look like with a modal and the status bar visible?

The same as without status bar, the status bar just takes some space at the top of the screen.

Screenshot 2025-03-10 at 15.05.56.png (1×878 px, 1 MB)

native/components/full-screen-view-modal.react.js
723–724

One thing that might be worth checking is whether the outsideButtons logic is still correct

angelika edited the summary of this revision. (Show Details)

Rebase & fix outsideButtons on Android