React-Navitive- cannot read property push of undefined

RN 开发当使用navitor 进行push到下一级时,会出现cannot read property push of undefined错误,好尴尬......

问题重现:
进行tabbar+navigation切换页面开发,需要实现的是push到第二级的时候tabbar需要隐藏,结构为navigation->tabbar->tabbarItem->HomeView
这时候进行push会出现上述错误。

解决方案:

render() {
        return (

                

                    {this.setState({selectedTab:'HomeView'})}}
                        selected={this.state.selectedTab === 'HomeView'}
                        titleStyle={HPTB_tabbarStyle.textStyle}
                        selectedTitleStyle={HPTB_tabbarStyle.selectedTextStyle}
                    >
//这里就是解决方法
                        

                    

                    {this.setState({selectedTab:'HomeView1'})}}
                        selected={this.state.selectedTab === 'HomeView1'}
                        titleStyle={HPTB_tabbarStyle.textStyle}
                        selectedTitleStyle={HPTB_tabbarStyle.selectedTextStyle}
                    >
//这里就是解决方法

                        

                    

                


        );
    }

参考链接:http://stackoverflow.com/questions/39350651/react-native-navigator-cannot-read-property-push-of-undefined

React-Navitive- cannot read property push of undefined_第1张图片

你可能感兴趣的:(React-Navitive- cannot read property push of undefined)