react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[v2] call dismissOverlay registerComponentDidAppearListener Not working

Open qiepeipei opened this issue 8 years ago • 10 comments

Navigation.dismissOverlay(this.props.componentId);

Navigation.events().registerComponentDidAppearListener(({componentId, componentName}) => {
   //Here Not working
});

---
### Environment
* React Native Navigation version: 2.0.2597
* React Native version: 0.57
* Platform(s) (iOS, Android, or both?): android
* Device info (Simulator/Device? OS version? Debug/Release?): Debug

qiepeipei avatar Oct 20 '18 09:10 qiepeipei

I'm not sure I understand the issue. Can you please PR a failing detox e2e test?

guyca avatar Oct 21 '18 06:10 guyca

@guyca

i has two pages:A and B, and in Page B, i showOverlay component C .

Navigation.dismissOverlay(this.props.componentId);

Navigation.events().registerComponentDidAppearListener(({componentId, componentName}) => {
   console.log(componentName)    // result 
});

console log result: from page A to page B : print "B" from page B to page A: print "A" in page B show overlay C: print "C" in page B hide overlay C: nothing has print, callback not work

qiepeipei avatar Oct 22 '18 01:10 qiepeipei

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Nov 26 '18 12:11 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Dec 03 '18 12:12 stale[bot]

Any updates on this?!?! We've got the same problem.... :( @qiepeipei did you find any solution?

marcorm avatar Apr 11 '19 16:04 marcorm

Navigation.events().registerCommandListener((name, { componentId }) => {
  console.log(name, componentId)
})

returns Also showOverlay, undefined

pontusab avatar May 29 '19 11:05 pontusab

You can hardcode the id of the overlay:

  Navigation.showOverlay({
    component: {
      name: 'test',
      id: 'test',
      options: {
        layout: {
          backgroundColor: 'transparent',
        },
        overlay: {
          interceptTouchOutside: false,
        },
      },
    },
  })

Then you know the id beforehand and can close it by Navigation.dismissOverlay('test)

pontusab avatar May 29 '19 11:05 pontusab

This is still an issue in 4.5.3!

landorid avatar Jan 19 '20 08:01 landorid

@Eldavid If I understand the issue correctly, you're expecting componentDidAppear event to be emitted after an Overlay is dismissed. componentDidAppear isn't emitted after Overlay is dismissed since when an Overlay is displayed, no screen disappears. Overlay is displayed in a different hierarchy level and doesn't cause screens in the app root or modals to disappear.

guyca avatar Jan 19 '20 14:01 guyca

Really, you are right! This is the expected behaviour.

landorid avatar Jan 19 '20 14:01 landorid