componentDidAppear not invoked when using setRoot on Android

🐛 Bug Report

componentDidAppear is not being triggered when the view is presented using Navigation.setRoot. This does not happen when the view is presented using Navigation.push, only with Navigation.setRoot.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

Either clone my repo and see index.js, or just add componentDidAppear method in any view presented using Navigation.setRoot

Expected behavior

I would expect componentDidAppear to be triggered regardless the way is presented

Actual Behavior

componentDidAppear not being invoked, yetcomponentDidDisappear seems to work.

Your Environment

  • React Native Navigation version: 7.11.3
  • React Native version: 0.64.0
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Andriod Simulator using Pixel 4XL/Android 11.0

Reproducible Demo

https://github.com/randomBrainstormer/RnnBugExample/blob/main/index.js

1 possible answer(s) on “componentDidAppear not invoked when using setRoot on Android

  1. It seems that if i use waitForRender set to true as the default option the event works as expected. Using this prop as part of the component options does not seem to work.

    // this works
    Navigation.setDefaultOptions({
      animations: {
        setRoot: {
          waitForRender: true
        },
      },
    })
    
    // this does NOT work
    const loginRoot = {
      root: {
        component: {
          name: 'Login',
          waitForRender: true,
        },
      },
    };
     Navigation.setRoot(loginRoot);