'Top tab navigator failing (React navigation 6)
I am just having an issue with exporting the navigator. I have a Stack navigator where I am nesting also a Drawer navigator and now I want to do the same with Tab navigator. It fails and says something about not exporting/importing components properly.
...
function navigation() {
return (
<NavigationContainer>
<Stack.Navigator
...
<Stack.Screen name="incoming_outgoing" component={GetTabButtons} />
</Stack.Navigator>
</NavigationContainer>
);
}
function GetTabButtons() {
const Tab = createMaterialTopTabNavigator();
return (
<Tab.Navigator>
<Tab.Screen name="IncomingOutgoing" component={IncomingOutgoing} />
<Tab.Screen name="IncomingOutgoingEmpty" component={IncomingOutgoingEmpty} />
</Tab.Navigator>
);
}
export default navigation;
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
I tried checking if I am exporting/importing something incorrectly but couldn't find anything.
Packages:
@react-navigation/native 6.0.10
@react-navigation/drawer 6.4.1
@react-navigation/material-top-tabs 6.2.1
@react-navigation/stack 6.2.1
react-native-safe-area-context 4.2.4
react-native-screens 3.13.1
react-native-gesture-handler 2.3.2
react-native-reanimated 2.2.4
react-native-tab-view 3.1.1
react-native-pager-view 5.4.15
react-native 0.68.0
node v16.13.1
npm 8.3.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
