React-native-navigation: registerBottomTabSelectedListener does not fire callback on tab change

Created on 8 Oct 2018  路  4Comments  路  Source: wix/react-native-navigation

Issue Description

Navigation.events().registerBottomTabSelectedListener(someFunc) does not fire someFunc when tabs are changed. My code is below (I am using Typescript. But that should have no effect on this discussion):

    constructor(props: any) {
        super(props);
        this.eventSubscription = Navigation.events().registerBottomTabSelectedListener(this.tabChanged);
    }

    tabChanged = (info: { selectedTabIndex: number, unselectedTabIndex: number }) => {
        this.props.onBottomTabChanged(info.selectedTabIndex);
    }

    componentWillUnmount() {
        this.eventSubscription.remove();
        super.componentWillUnmount();
    }

Environment

  • React Native Navigation version: 2.0.2577
  • React Native version: 0.53.3
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Device, 12.0.0, Debug
iOS v2

Most helpful comment

I think I may have solved the issue. But i am not sure:
Added "self.delegate = self;" in function initWithLayoutInfo in RNNTabBarController.m

All 4 comments

I think I may have solved the issue. But i am not sure:
Added "self.delegate = self;" in function initWithLayoutInfo in RNNTabBarController.m

@rishabhpoddar this is correct.

@jcsena cheers!

Fixed fee53a1a914bceb2980a5f682d57ed267257c480
Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

birkir picture birkir  路  3Comments

zagoa picture zagoa  路  3Comments

edcs picture edcs  路  3Comments

EliSadaka picture EliSadaka  路  3Comments

yayanartha picture yayanartha  路  3Comments