Passing props to 'sideMenu' during open-drawer does not honor 'passProps', e.g.:
Navigation.mergeOptions( componentId, {
sideMenu: {
left: {
visible: true,
component: {
name: 'SideMenu',
passProps: {
name: value,
}
}
}
}
});
Is there any way to dynamically pass props from another component into sideMenu component?
Same request. I need a way to pass props to sideMenu component.
There are multi tabs and when the side menu is shown, I want to pass the component ID of the tab screen, so that I can tell which tab screen called the side menu.
Or is there a way to figure out the current selected tab's componentId from SideMenu?
also in need of this
@guyca
Are there any plans to dynamically pass props to the sideMenu?
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 Should be possible to pass props
I'm having the same problem. I need to pass props to my side menu component in order to know the componentId of the tab screen that is opened. When I try to access my props I always get "undefinied"... I'm using Android by the way.
Any ideas how to pass props to side menu?
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.
still relevant
Same need. how do we pass props to sideMenu component.
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.
still useful
So from what I see there is still no possibility to pass Prop by merging. I need it in the sideMenu in order to decide what item should be disabled. The only way I would fix it right now is by storing center componentID inside of redux store and pulling it in the side menu, and I really don't want to do that.
How did you handle this?
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.
The issue has been closed for inactivity.
@guyca this is still needed and the stale bot is not helping one bit :(
Still a relevant issue
you can easily pass props to sideMenu
like so:
continueBtnOnPress={() => {
RouterManager.mergeOptions('BottomTabsId', {
sideMenu: {
right: {
enabled: true,
visible: true,
component: {
name: 'redirectFromSideMenu',
passProps: {
redirectFromSideMenu: componentId,
redirectToScreen: screenNames.BROADBAND_COMPLETE,
},
},
},
},
});
}}
then, providing you have got this.navigator.events().registerCommandListener(async (name, params)
listener to the merger options event in navigation, you have to listen to the mergeOptions event
name === 'mergeOptions'
and go to the navigation state : this.navigator.store.propsById
, where you will be able to get the passed property and the componentId
, the most coveted piece of data in my case, as I wanted to redirect user to another screen programmatically from the sideMenu. That's it. No redux needed.
I used this library to overcome the limitations of sidemenu
http://www.lib4dev.in/info/lukebrandonfarrell/react-native-navigation-drawer-extension/171316468
Most helpful comment
you can easily pass props to
sideMenu
like so:continueBtnOnPress={() => { RouterManager.mergeOptions('BottomTabsId', { sideMenu: { right: { enabled: true, visible: true, component: { name: 'redirectFromSideMenu', passProps: { redirectFromSideMenu: componentId, redirectToScreen: screenNames.BROADBAND_COMPLETE, }, }, }, }, }); }}
then, providing you have got
this.navigator.events().registerCommandListener(async (name, params)
listener to the merger options event in navigation, you have to listen to the mergeOptions event
name === 'mergeOptions'
and go to the navigation state :
this.navigator.store.propsById
, where you will be able to get the passed property and thecomponentId
, the most coveted piece of data in my case, as I wanted to redirect user to another screen programmatically from the sideMenu. That's it. No redux needed.