Skip to content

Diference in behavior from android vs iOS for the RNN.ComponentWillAppear eventΒ #7906

@iurysza

Description

@iurysza

What happened?

Hello there!

If a user has a partially visible modal open (with the overCurrentContext flag) and then sends the app to the background, when bringing it back to the foreground it triggers two willAppear events in React Native. One event is for the modal, and the other is for the modal's parent view.

This is how we listen to the event:

  Navigation.events().registerComponentWillAppearListener(({ componentId }) => {}

This issue is specific to Android. On iOS, only one event is sent, which is related to the modal.

It seems that on Android, these events are triggered by the onGlobalLayout callback at./viewcontrollers/viewcontroller/ViewController.java:308, and not the onHostResume call stack.

While this could be interpreted as intended behavior, iOS only emits one event for the partially visible modal and none for the parent view.

What was the expected behaviour?

Our expectation was that both platforms should behave the same way: either by sending only one event for the top most view or one event for each view that is visible or partially visible.

Was it tested on latest react-native-navigation?

  • I have tested this issue on the latest react-native-navigation release and it still reproduces.

In what environment did this happen?

React Native Navigation version: 7.38.3
React Native version: 0.72.9
Has Fabric (React Native's new rendering system) enabled: (yes/no): NO
Node version: 18.17
Device model: Pixel 8 Pro
Android version: Android 14

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions