[v6][iOS12] Side menu, ComponentDidAppear is triggered but visible is false
Issue Description
ComponentDidAppear is called for sideMenu although sideMenu is not visible on iOS12.
Steps to Reproduce / Code Snippets / Screenshots
Simple side menu setup:
Root Config:
{
root: {
sideMenu: {
left: {
component: {}
},
center: {
bottomTabs: {
children: [
{
stack: {
children: [/* Component */],
}
},
{
stack: {
children: [/* Component */],
}
}
],
}
}
}
}
};
Navigation.events().registerComponentDidAppearListener(({ componentName }) => {});
Callback Is called for side menu although sideMenu.left.visible: false and side menu is not visible on screen.
After opening side menu (swipe) componentDidAppear is not called. When side menu is closed (swipe) componentDidDisappear is called as it should be. If side menu is reopened componentDidAppear is finally called.
I have a topBar button that needs to be aware of sideMenu (open/closed) state and this bug prevents it from working :/
This behaviour is only observable on iOS12. It's working perfectly on iOS13.
Environment
- React Native Navigation version: 6.3.1
- React Native version: 0.61.5
- Platform(s: iOS 12
- Device info: Simulator Debug&Release
I cannot seem to reproduce this problem on the Playground app. Could you provide a minimal reproduction for me to have a look?
@jinshin1013 will do! EDIT: Indeed, tried to reproduce with the playground app and didn't face the same issue. I'll check my config again and try to reproduce it.
@ericschaal Thanks! Let me know how you go
@jinshin1013 @ericschaal I ran into the same problem. Same iOS version sensitivity (only 12.4). After a little experimentation I found it was introduced between 6.1.2 and 6.2.0. I'm not familiar enough with the code to diagnose it, but there are several RNNSideMenu*.m changes in there: 6.1.2..6.2.0 diff
I haven't tried to setup and reproduce in the playground yet, but thought I'd share this in the meantime if something popped out in the diff. One difference between my app and the playground is that the sideMenu is setup on the root view whereas the playground seems to bring it up as a modal on top of the initial root. I will update if I can reproduce on the playground app.
On a related note, I'm using componentDidAppear to keep track of the sideMenu because I couldn't find a way to inspect the open/closed state. Is there a way that I missed?
I also noticed that the playground has the same issue that this approach solves in that the user can't close the sideMenu by tapping the 'hamburger'.
Thanks!
Same problem here. Sometimes I have to press 2 times the sidemenu burger.
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 version and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Hello, I'm also encountering this issue on iOS 12.
I'll see if I can find out more about it.
I think this issue should be re-opened.
Edit 1:
In the spoiler below is playground setup to reproduce the issue (on RNN 6.8.0).
Reproduce
diff --git a/playground/src/app.js b/playground/src/app.js
index 3a429339f..cda3fbad7 100644
--- a/playground/src/app.js
+++ b/playground/src/app.js
@@ -1,6 +1,7 @@
// @ts-check
const Navigation = require('./services/Navigation');
const {registerScreens} = require('./screens');
+const {SideMenu} = require('./screens/Screens');
const {Platform} = require('react-native');
const {setDefaultOptions} = require('./commons/Options')
const testIDs = require('./testIDs');
@@ -17,10 +18,17 @@ alert = (title, message) => Navigation.showOverlay({
}
});
+function registerScreenEventListeners() {
+ Navigation.events().registerComponentDidAppearListener(({ componentName }) => {
+ console.log(`componentDidAppear: ${componentName}`)
+ });
+}
+
function start() {
registerScreens();
Navigation.events().registerAppLaunchedListener(async () => {
setDefaultOptions();
+ registerScreenEventListeners();
Navigation.dismissAllModals();
setRoot();
});
@@ -28,66 +36,7 @@ function start() {
function setRoot() {
Navigation.setRoot({
- root: {
- bottomTabs: {
- children: [
- {
- stack: {
- children: [
- {
- component: {
- name: 'Layouts'
- }
- }
- ],
- options: {
- bottomTab: {
- text: 'Layouts',
- icon: require('../img/layouts.png'),
- selectedIcon: require('../img/layouts_selected.png'),
- testID: testIDs.LAYOUTS_TAB
- }
- }
- }
- },
- {
- stack: {
- children: [
- {
- component: {
- name: 'Options'
- }
- }
- ],
- options: {
- topBar: {
- title: {
- text: 'Default Title'
- }
- },
- bottomTab: {
- text: 'Options',
- icon: require('../img/options.png'),
- selectedIcon: require('../img/options_selected.png'),
- testID: testIDs.OPTIONS_TAB
- }
- }
- }
- },
- {
- stack: {
- children: [
- {
- component: {
- name: 'Navigation'
- }
- }
- ]
- }
- }
- ]
- }
- }
+ root: SideMenu
});
}
The expected behaviour would be:
without any user action
When the first screen is displayed only componentDidAppear: SideMenuCenter will get logged.
The actual behaviour on iOS 12 is that componentDidAppear: SideMenuCenter and then componentDidAppear: SideMenuLeft get logged.
Both on iOS 13 and Android the behaviour is as expected.
Hi, is there any news about this issue ? It is still occurs in v7 (for iOS <= 12).
I'm seeing this happening always for the first child of the bottomTabs on android only. Any time the app is opened from a closed state, for some reason I'm seeing this event fire from registerComponentDidAppearListener
I'm seeing this happening always for the first child of the bottomTabs on android only. Any time the app is opened from a closed state, for some reason I'm seeing this event fire from registerComponentDidAppearListener
I'm also counter this but not see this event fire from registerComponentDidAppearListener.
@bneigher this issue was reported for iOS only - can you please open another issue with a reproduction for Android?
Closing this as part of a maintainer cleanup of open issues older than one year.
Decision: Closed: non-critical feature request/question/discussion.
If this still reproduces on the latest React Native Navigation with a minimal reproduction, please open a new issue with current RN/RNN versions and repro steps.