TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[31], "react-navigation-tabs").createMaterialTopTabNavigator')
Version
Tell us which versions you are using:
I am using yarn install my package.json
- react-native-router-flux 4.3.1
- react v17.0.2
- react-native v0.67.3
At first, I wrote TabBar by myself through React-native router-Flux, and then I found this problem: TypeError: undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[31], "react-navigation-tabs").createMaterialTopTabNavigator')
Later, when I wrote TabBar according to the official Demo, this problem still appeared.
const Routers = () => ( <Stack key="root" titleStyle={{alignSelf: 'center'}} hideNavBar> <Tabs key="tabbar" routeName="tabbar" backToInitial onTabOnPress={() => { console.log('Back to initial and also print this'); }} showLabel={false} tabBarStyle={styles.tabBarStyle} activeBackgroundColor="white" inactiveBackgroundColor="rgba(255, 0, 0, 0.5)"> <Stack key="tab_1" title="Tab #1" tabBarLabel="TAB #1" inactiveBackgroundColor="#FFF" activeBackgroundColor="#DDD" icon={TabIcon} navigationBarStyle={{backgroundColor: 'green'}} titleStyle={{color: 'white', alignSelf: 'center'}}> <Scene key="tab_1_1" component={TabView} title="Tab #1_1" onRight={() => alert('Right button')} rightTitle="Right" />
<Scene
key="tab_1_2"
component={TabView}
title="Tab #1_2"
back
titleStyle={{color: 'black', alignSelf: 'center'}}
/>
</Stack>
<Stack key="tab_2" title="Tab #2" icon={TabIcon} initial>
<Scene
key="tab_2_1"
component={TabView}
title="Tab #2_1"
renderRightButton={() => <Text>Right</Text>}
/>
<Scene
key="tab_2_2"
component={TabView}
title="Tab #2_2"
back
onBack={() => alert('onBack button!')}
hideDrawerButton
backTitle="Back!"
panHandlers={null}
/>
</Stack>
</Tabs>
</Scene>
</Stack>
</Lightbox>
</Modal>
Source: aksonov/react-native-router-flux