timomeh / react-native-material-bottom-navigation

💅🔧👌 a beautiful, customizable and easy-to-use material design bottom navigation for react-native
MIT License
709 stars 127 forks source link

Cannot read property getIconRef of undefined (BottomNavigation.js:259:24) #21

Closed ask007learning closed 7 years ago

ask007learning commented 7 years ago

I am using this library with react-navigation, below is my router config: It is strange, sometimes it works and sometime doesn't.

let tabConfig = {
    tabBarComponent: NavigationComponent,
    tabBarPosition: 'bottom',
    tabBarOptions: {
        bottomNavigationOptions: {
            labelColor: 'white',
            rippleColor: 'white',
            tabs: {
                HomeNav: {
                    barBackgroundColor: '#03A9F4'
                },
                Following: {
                    barBackgroundColor: '#009688'
                },
                Notification: {
                    barBackgroundColor: '#ef5350'
                }
            }
        }
    }
};

export const Tabs = TabNavigator({
    HomeNav: {
        screen: Home,
        navigationOptions: {
            tabBar: {
                label: 'Prayer time',
                icon: () => <Icon name="account-circle" size={24} color={'white'} />
            },
        },
    },
    Following:{
        screen: FollowingViewContainer,
        navigationOptions: {
            tabBar: {
                label: 'Following',
                icon: () => <Icon name="list" size={24} color={'white'} />
            },
        },
    },
    Notification: {
        screen: NotificationViewContainer,
        navigationOptions: {
            tabBar: {
                label: 'Notification',
                icon: () => <Icon name="notifications" size={24} color={'white'} />
            },
        },
    },
}, tabConfig);
timomeh commented 7 years ago

I encountered this, too. In my case it happened if the component was hidden/unmounted. I fixed it a while ago but didn't publish a release, and then forgot about it. So, I published it now. 😅

Please update to v0.4.1 and tell me if that solves your issue. 🙂

ask007learning commented 7 years ago

Thanks for a quick reply, It is working now.