I'm using bottom navigation in one of my apps, and have run into a problem.
I want to send some event to the cloud whenever user uses bottom navigation to land on a page, let's say A1.
Here's my code:
const tabBarConfigs = { lazy: true, animationEnabled: true, tabBarComponent: props => <AppBottomTab {...props} />, tabBarOptions: { style: { backgroundColor: Fonts.Colors.transparent, }, activeTintColor: Fonts.Colors.reddishPink, inactiveTintColor: Fonts.Colors.fullBlack, labelStyle: { fontFamily: Fonts.Medium, fontSize: 10, marginTop: -2 }, upperCaseLabel: true, allowFontScaling: false, showIcon: true, }, defaultNavigationOptions: { tabBarOnPress: ({ navigation, defaultHandler }) => { defaultHandler(); navigation.setParams({ eventData: { source: "bottom_nav", }, }); if (navigation.isFocused()) { const scrollToTop = navigation.getParam("scrollToTop", null); if (scrollToTop) { scrollToTop(); } } }, },};
The problem is, when the user lands from any other touchpoint (other than bottom navigation) then also the eventData is already set in navigation. How to avoid that ?
Have been struggling with this for 3 days. Can anyone help here ?