Hidding tab bar bottom navigation from certain route screens - react-native

I'm attempting to remove the tab bar bottom navigator from certain pages from my application. I have performed several searches with indication to use display:none or other methods, but they are not seeming to work. I have several nested routes inside of the Main route.
This is the tab route:
export function TabRoutes({ navigation }: any) {
const { Navigator, Screen } = createBottomTabNavigator();
const theme = useTheme();
return (
<Navigator
initialRouteName="FeedRt"
screenOptions={{
headerShown: false,
tabBarActiveTintColor: theme.colors.primary,
tabBarStyle: {
backgroundColor: theme.colors.tabBarBackground,
position: 'absolute',
borderTopRightRadius: 16,
borderTopLeftRadius: 16,
borderColor: '#9E9E9E',
borderWidth: RFValue(0.5),
borderStyle: 'solid',
bottom: -10,
height: 90,
paddingHorizontal: 16,
// tabBarStyle: { display: 'none' }
},
}}
>
<Screen
key="FeedRt"
name="FeedRt"
component={FeedRoutes}
options={{
tabBarIcon: ({ focused }) => (
<TabBarIconAndText text="Home" focused={focused} icon="Home" />
),
tabBarLabel: '',
}}
/>
<Screen
key="SearchRt"
name="SearchRt"
component={SearchRoutes}
options={{
tabBarIcon: ({ focused }) => (
<TabBarIconAndText text="Search" focused={focused} icon="Search" />
),
tabBarLabel: '',
}}
/>
<Screen
key="CreatePosts"
name="CreatePosts"
component={EmptyScreen}
listeners={({ navigation }) => ({
tabPress: (event) => {
event.preventDefault();
},
})}
options={{
tabBarIcon: ({ focused }) => (
<ToolTip navigation={navigation}>
<View
style={{
marginTop: 10,
flexDirection: 'row',
backgroundColor: theme.colors.primary,
width: 40,
height: 40,
borderRadius: 20,
justifyContent: 'center',
alignItems: 'center',
}}
>
<PlusSVG />
</View>
</ToolTip>
),
tabBarLabel: '',
}}
/>
<Screen
key="Shorts"
name="Shorts"
component={Shorts}
options={{
tabBarIcon: ({ focused }) => (
<TabBarIconAndText text="Shorts" focused={focused} icon="Shorts" />
),
tabBarLabel: '',
}}
/>
<Screen
key="Profile"
name="Profile"
children={() => <Profile navigation={navigation} myProfile={true} />}
options={{
tabBarIcon: ({ focused }) => (
<TabBarIconAndText text="Profile" focused={focused} icon="Profile" />
),
tabBarLabel: '',
}}
/>
</Navigator>
);
}
I want to remove the tab bar showing in the Comments from the FeedRoute
import React from 'react';
import { createStackNavigator } from '#react-navigation/stack';
// Screens
import { Feed } from '../screens/FeedScreens/Feed';
import { Comments } from '../screens/FeedScreens/Comments';
export function FeedRoutes() {
const { Navigator, Screen } = createStackNavigator();
return (
<Navigator initialRouteName="Posts" screenOptions={{ headerShown: false }}>
<Screen key="Posts" name="Posts" component={Feed} />
<Screen key="Comments" name="Comments" component={Comments} />
</Navigator>
);
}
And I have this App route witch calls the Main (Tab route):
import React from 'react';
import { createStackNavigator } from '#react-navigation/stack';
// Screens
import { TabRoutes } from './tab.routes';
import { PostRoutes } from './post.routes';
import { FeedRoutes } from './feed.routes';
export function AppRoutes() {
const { Navigator, Screen } = createStackNavigator();
return (
<Navigator initialRouteName="Main" screenOptions={{ headerShown: false }}>
<Screen key="Main" name="Main" component={TabRoutes} />
<Screen key="Post" name="Post" component={PostRoutes} />
</Navigator>
);
}
Want to remove it from this screen:

Just move Comments route from FeedRoutes to AppRoutes.
replace component={FeedRoutes} to component={Feed} in TabRoutes.
There is no need to create FeedRoutes component.
See more https://reactnavigation.org/docs/hiding-tabbar-in-screens/

Related

React Native Navigation. How to add component to bottom stack navigator but not display it

I want to add a component (let's say "Autobus") to bottom stack navigator so it will receive "navigation" argument, and I will be able to navigate to "Autobus" component - navigation.navigate('Autbous'). However, I do not want to actually display "Autobus" component in the "Tab.Navigator".
I have the following code:
import React from 'react'
import { Ionicons } from '#expo/vector-icons'
import { StyleSheet, View, TouchableOpacity } from 'react-native'
import { createBottomTabNavigator } from '#react-navigation/bottom-tabs'
import THEME from '../theme'
import PostsScreen from '../screens/PostsScreen'
import CreateScreen from '../screens/CreateScreen'
import ProfileScreen from '../screens/ProfileScreen'
const Tab = createBottomTabNavigator()
const Tabs = () => {
return (
<Tab.Navigator
initialRouteName='Posts'
screenOptions={{
tabBarShowLabel: false,
tabBarStyle: { ...styles.tab, ...styles.shadow }
}}
>
<Tab.Screen
name='Profile'
component={ProfileScreen}
options={{
tabBarIcon: ({ focused }) => (
<CustomTabIcon focused={focused} iconName='person' />
)
}}
/>
<Tab.Screen
name='Create'
component={CreateScreen}
options={{
// tabBarShowLabel: true,
tabBarIcon: ({ focused }) => (
<CustomTabIcon focused={focused} iconName='add' />
),
tabBarButton: props => <CustomCircleButton {...props} />
}}
/>
<Tab.Screen
name='Posts'
component={PostsScreen}
options={{
tabBarIcon: ({ focused }) => (
<CustomTabIcon focused={focused} iconName='search' />
)
}}
/>
</Tab.Navigator>
)
}
const CustomTabIcon = ({ focused, iconName }) => {
return (
<Ionicons
size={24}
color={THEME.INFO_COLOR}
name={focused ? iconName : `${iconName}-outline`}
/>
)
}
const CustomCircleButton = ({ children, onPress }) => {
return (
<TouchableOpacity
onPress={onPress}
style={{
...styles.center,
...styles.shadow
}}
>
<View style={styles.circle}>{children}</View>
</TouchableOpacity>
)
}
const styles = StyleSheet.create({
tab: {
position: 'absolute',
bottom: 15,
left: 20,
right: 20,
elevation: 0,
backgroundColor: 'white',
borderRadius: 15,
height: 70
},
shadow: {
shadowColor: '#7f5df0',
shadowOffset: {
width: 0,
height: 10
},
shadowOpacity: 0.25,
shadowRadius: 3.5,
elevation: 5
},
center: {
top: -20,
justifyContent: 'center',
alignItems: 'center'
},
circle: {
width: 70,
height: 70,
borderRadius: 35,
backgroundColor: THEME.DANGER_COLOR
}
})
export default Tabs
You need to create stack navigator for nesting navigation(bottom tabs/top tabs/ seperate screens)
read more https://reactnavigation.org/docs/nesting-navigators/
import { NavigationContainer } from '#react-navigation/native';
import { createNativeStackNavigator } from '#react-navigation/native-stack';
const Tab = createBottomTabNavigator();
const Stack = createNativeStackNavigator();
const Tabs = () => {
return (
<Tab.Navigator initialRouteName='Posts'>
<Tab.Screen name='Profile' component={ProfileScreen}/>
<Tab.Screen name='Create' component={CreateScreen}/>
<Tab.Screen name='Posts' component={PostsScreen}/>
</Tab.Navigator>
)
}
const App = () => {
return(
<NavigationContainer>
<Stack.Navigator initialRouteName='Tabs'>
<Stack.Screen name="Tabs" component={Tabs} /> // bottom tabs will be base screen
<Stack.Screen name = "Autobus" commponent={Autobus} />
</Stack.Navigator>
</NavigationContainer>
)
}

Can't call a nested navigation screen from a deep component in react native

I have followed this tutorial and created Drawer and Main Tab Navigations for my react native expo app.
Now I need a screen which should not be listed in Drawer or Tab and which is needed to be called from a deep component where navigations props are not being sent.
I tried useNavigation Hook but got error where react native is unable to find any such screen name.
PFB the tentative sample codes:
Main Tab called from App.js
const Tab = createMaterialBottomTabNavigator();
const HomeStack = createStackNavigator();
const ProfileStack = createStackNavigator();
const ListStack = createStackNavigator();
const MainTabScreen = () => (
<Tab.Navigator
initialRouteName="Home"
activeColor="#fff"
barStyle={{ backgroundColor: '#009387' }}
>
<Tab.Screen
name="Home"
component={HomeStackScreen}
options={{
tabBarLabel: 'Home',
tabBarColor: '#009387',
tabBarIcon: ({ color }) => (
<Icon name="home" color={color} size={26} />
),
}}
/>
<Tab.Screen
name="Profile"
component={ProfileStackScreen}
options={{
tabBarLabel: 'Profile',
tabBarColor: '#1f65ff',
tabBarIcon: ({ color }) => (
<Icon name="aperture" color={color} size={26} />
),
}}
/>
</Tab.Navigator>
);
export default MainTabScreen;
const HomeStackScreen = ({navigation}) => (
<HomeStack.Navigator screenOptions={{
headerStyle: {
backgroundColor: '#009387',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold'
}
}}>
<HomeStack.Screen name = "Home" component = {Home}
options = {{
title: 'Overview',
headerLeft: () => (
<Icon.Button name="menu" size={25}
backgroundColor="#009387" onPress={()=>navigation.openDrawer()}
></Icon.Button>
)
}}
/>
</HomeStack.Navigator>
);
const ProfileStackScreen = ({navigation}) => (
<ProfileStack.Navigator screenOptions={{
headerStyle: {
backgroundColor: '#d02860',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold'
}
}}>
<ProfileStack.Screen name = "Profile" component = {Profile}
options = {{
headerLeft: () => (
<Icon.Button name="menu" size={25}
backgroundColor="#d02860" onPress={()=>navigation.openDrawer()}
></Icon.Button>
)
}}
/>
</ProfileStack.Navigator>
);
const ListStackScreen = ({navigation}) => (
<NotificationsStack.Navigator screenOptions={{
headerStyle: {
backgroundColor: '#694fad',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold'
}
}}>
<ListStack.Screen name = "List" component = {List}
options = {{
headerLeft: () => (
<Icon.Button name="menu" size={25}
backgroundColor="#694fad" onPress={()=>navigation.openDrawer()}
></Icon.Button>
)
}}
/>
</NotificationsStack.Navigator>
);
useNavigation component section:
import { useNavigation } from '#react-navigation/native';
.
.
.
const SomeStuff = ({item}) => {
......
<ListButton title={Count} screenName="ListStackScreen" />
.....
}
.
.
function ListButton({ title, screenName }) {
const navigation = useNavigation();
return (
<Button
title={`${title} Total`}
onPress={() => navigation.navigate(screenName)}
/>
);
}
also tried:
navigation.navigate('HomeDrawer',{screen: screenName})
I need to call the above ListStackScreen from a deep component. I tried using navigation.navigate(ListStackScreen) but it doesn't work as explained above.
Please let me know how to use the screen without displaying it in any Drawer or Tab visually.
Edit: Update after trying the given answer
I do have this in the main app.js also:
<Drawer.Screen name="HomeDrawer" component={MainTabScreen} />
This setup should allow you to navigate between HomeStackScreen and ListStackScreen.
const Stack = createStackNavigator();
function HomeStack() {
return (
<Stack.Navigator
initialRouteName="HomeStackScreen">
<Stack.Screen
name="HomeStackScreen"
component={HomeStackScreen}
/>
<Stack.Screen
name="ListStackScreen"
component={ListStackScreen}
/>
</Stack.Navigator>
);
}
<NavigationContainer>
<Tab.Navigator
initialRouteName="HomeStack">
<Tab.Screen
name="HomeStack"
component={HomeStack}
}}
/>
…
You can nest stacknavigator into Drawer, the inner stacknavigator screen won‘t be shown in Drawer.
I have created an sample

Navigation in react-native error with stackNavigation

in the application I am creating I have set up bottom-tabs. They are functioning properly.
const Tab = createBottomTabNavigator();
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator initialRouteName="Feed"
tabBarOptions={{activeTintColor: '#F78400'}}>
<Tab.Screen
name="Authentication" component={Authentication}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("./assets/images/authentication.jpg")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
<Tab.Screen
name="Dashboard"
component={Dashboard}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("./assets/images/dashboard.png")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
<Tab.Screen
name="Tools"
component={Tools}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("./assets/images/tools.png")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
<Tab.Screen
name="Settings"
component={Settings}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("./assets/images/settings.png")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
</Tab.Navigator>
</NavigationContainer>
);
}
So now, I want to set up navigation to be able to go from one screen to another. I added the code of the stacks to the code of my tabs and when I want to go on antorher screen, I click a button to go on another screen, the name of the screen appear at the top of the page but it looks like it still the first screen. I don't get what's wrong
view config getter callback for component,
could you please explain to me how to do? Thanks a lot.
import React from 'react'
import { Image } from 'react-native'
import { createBottomTabNavigator } from '#react-navigation/bottom-tabs'
import { createStackNavigator} from "#react-navigation/stack"
import { NavigationContainer } from '#react-navigation/native'
import Authentication from '../../Screens/Authentication'
import Login from '../../Screens/Authentication'
import Signup from '../../Screens/Authentication'
import Tools from '../../Screens/Tools'
import Dashboard from '../../Screens/Dashboard'
import Settings from '../../Screens/Settings'
import Scan from '../../Screens/Tools'
import i18n from '../../src/i18n'
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
function ScreenNavigator() {
return(
<Stack.Navigator>
<Stack.Screen name = 'Authentication' component = {Authentication}/>
<Stack.Screen name = 'Login' component = {Login}/>
<Stack.Screen name = 'Signup' component = {Signup}/>
<Stack.Screen name = 'Tools' component = {Tools}/>
<Stack.Screen name = 'Scan' component = {Scan}/>
<Stack.Screen name = 'Dashboard' component = {Dashboard}/>
<Stack.Screen name = 'Settings' component = {Settings}/>
</Stack.Navigator>
)
}
export default function AppNavigation() {
return (
<NavigationContainer>
<Tab.Navigator initialRouteName="Feed"
tabBarOptions={{activeTintColor: '#F78400'}}>
<Tab.Screen
name={i18n.t("app.auth")}
component={ScreenNavigator}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("../../assets/images/authentication.jpg")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
<Tab.Screen
name={i18n.t("app.dash")}
component={Dashboard}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("../../assets/images/dashboard.png")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
<Tab.Screen
name={i18n.t("app.tools")}
component={Tools}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("../../assets/images/tools.png")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
<Tab.Screen
name={i18n.t("app.settings")}
component={Settings}
options={{
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return (
<Image
source={require("../../assets/images/settings.png")}
style={{ width: 20, height: 20 }}
/>
);
}
}}
/>
</Tab.Navigator>
</NavigationContainer>
)
}
You are not passing components when initializing the navigation
The below code
<Stack.Screen name = 'Authentication' component = 'Authentication'/>
You have passed a string for component which is causing the error, this should change to
<Stack.Screen name = 'Authentication' component = {Authentication}/>
You will have to change other screens in the stack as well

How to define different groups of navigation flow in React-Navigation 5

In pre-5 version of React-Navigation, I use the following JSON style configuration to define multiple navigation flows & embed one flow to the other:
// declare a stack navigator named 'dataListFlow'
const dataListFlow = createStackNavigator({
DataList: DataListScreen,
DataDetail: DataDetailScreen,
});
// I use the switch navigator to host two flows: 1. loginFlow 2. mainFlow
const switchNavigator = createSwitchNavigator({
// 1. loginFlow
loginFlow: createStackNavigator({
Signup: SignupScreen,
Signin: SigninScreen,
}),
// 2. mainFlow, NOTE: I embed the dataListFlow into the main flow
mainFlow: createBottomTabNavigator({
dataListFlow: dataListFlow,
dataCreate: dataCreateScreen,
}),
});
// create the app with the switchNavigator declared above
const App = createAppContainer(switchNavigator);
I would like to implement the same with React-Navigation version 5. I have followed this tutorial to create different navigators with React-Navigation 5, but it only shows how to create each type of navigator separately. I wonder how to implement navigation flows that can be embed into one another like what I have done with the older version react-navigation. Could someone please guide me with some code?
Nothing much has changed actually, the syntax and the way to addressing has changed,
So if you see below what i've used is a bottom tab, ive created it separately and now :
const BottomTab = () => {
return (
<Tab.Navigator
tabBarOptions={{
activeTintColor: '#fff',
activeBackgroundColor: '#c47808',
inactiveBackgroundColor: '#ffbd5c',
inactiveTintColor: '#c47808',
style: {
height: Platform.OS == 'ios' ? hp('10.35%') : hp('8.35%'),
},
labelStyle: {
marginBottom: Platform.OS == 'ios' ? 8 : 2,
},
}}
screenOptions={({route}) => ({
tabBarIcon: ({focused, color, size}) => {
return getTabBarIcon(route, focused);
},
})}>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Meetings" component={Meeting} />
<Tab.Screen name="My Profile" component={Profile} />
<Tab.Screen name="Settings" component={Settings} />
</Tab.Navigator>
);
};
Update:
const HomeTab = () => {
return (
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerShown: false,
}}>
<Stack.Screen name="Payment" component={Payment} />
<Stack.Screen name="Profile" component={Profile} />
</Stack.Navigator>
);
};
if you see how ive included this in my main stack navigator :
return (
<NavigationContainer linking={deepLinking}>
<Stack.Navigator
initialRouteName="Login"
screenOptions={{
headerShown: false,
}}>
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="HomeTab" component={HomeTab} />
<Stack.Screen name="BottomTab" component={BottomTab} />
</Stack.Navigator>
</NavigationContainer>
);
i've included it as a simple Stack.Screen and voila it's allscreen are used. Same you can do for if you want to use any other stack navigator and import it as stack.screen inside the main returning compoenent.
UPDATE:
See above updated stackscreennavigator
hope it helps. feel free for doubts
UPDATE 2 :
All my code :
import React, {Component} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Image,
Platform,
} from 'react-native';
import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import {NavigationContainer} from '#react-navigation/native';
import {createStackNavigator} from '#react-navigation/stack';
import {createBottomTabNavigator} from '#react-navigation/bottom-tabs';
import LoginScreen from './app/views/auth/LoginScreen';
import SignupEmail from './app/views/auth/SignupEmailScreen';
import SignupDetails from './app/views/auth/SignupDetails';
import Home from './app/views/home/Home';
import Meeting from './app/views/meetings/Meeting';
import Profile from './app/views/profile/Profile';
import Settings from './app/views/settings/Settings';
import ScheduleMeeting from './app/views/meetings/ScheduleMeeting';
import MeetCall from './app/views/meet/MeetCall';
import JitSiCall from './app/views/meet/Jitsi';
import {
widthPercentageToDP as wp,
heightPercentageToDP as hp,
} from 'react-native-responsive-screen';
import Webrtc from './app/views/meet/Webrtc';
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
// this function gives the icons when tab is selected
const getTabBarIcon = (route, focused) => {
const routeName = route.name;
if (routeName === 'Home') {
if (focused) {
return (
<Image
style={{height: 22, width: 23}}
source={require('./app/assets/images/homeF.png')}
/>
);
} else {
return (
<Image
style={{height: 22, width: 23}}
source={require('./app/assets/images/homeUf.png')}
/>
);
}
}
if (routeName === 'Meetings') {
if (focused) {
return (
<Image
style={styles.imageHeight}
source={require('./app/assets/images/meetingsF.png')}
resizeMode="contain"
/>
);
} else {
// console.log(props, 'props');
return (
<Image
style={styles.imageHeight}
source={require('./app/assets/images/meetingsUF.png')}
resizeMode="contain"
/>
);
}
}
if (routeName === 'My Profile') {
if (focused) {
return (
<Image
style={styles.imageHeight}
source={require('./app/assets/images/profileF.png')}
resizeMode="contain"
/>
);
} else {
return (
<Image
style={styles.imageHeight}
source={require('./app/assets/images/profileUf.png')}
resizeMode="contain"
/>
);
}
}
if (routeName === 'Settings') {
if (focused) {
return (
<Image
style={styles.imageHeight}
source={require('./app/assets/images/settingsF.png')}
resizeMode="contain"
/>
);
} else {
return (
<Image
style={styles.imageHeight}
source={require('./app/assets/images/settingsUf.png')}
resizeMode="contain"
/>
);
}
}
};
const BottomTab = () => {
return (
<Tab.Navigator
tabBarOptions={{
activeTintColor: '#fff',
activeBackgroundColor: '#c47808',
inactiveBackgroundColor: '#ffbd5c',
inactiveTintColor: '#c47808',
style: {
height: Platform.OS == 'ios' ? hp('10.35%') : hp('8.35%'),
},
labelStyle: {
marginBottom: Platform.OS == 'ios' ? 8 : 2,
},
}}
screenOptions={({route}) => ({
tabBarIcon: ({focused, color, size}) => {
return getTabBarIcon(route, focused);
},
})}>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Meetings" component={Meeting} />
<Tab.Screen name="My Profile" component={Profile} />
<Tab.Screen name="Settings" component={Settings} />
</Tab.Navigator>
);
};
class App extends Component {
render() {
return (
<NavigationContainer linking={deepLinking}>
<Stack.Navigator
initialRouteName="Login"
screenOptions={{
headerShown: false,
}}>
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="SignupEmail" component={SignupEmail} />
<Stack.Screen name="SignupDetails" component={SignupDetails} />
<Stack.Screen name="ScheduleMeeting" component={ScheduleMeeting} />
<Stack.Screen name="BottomTab" component={BottomTab} />
<Stack.Screen name="MeetCall" component={MeetCall} />
<Stack.Screen name="JitSiCall" component={JitSiCall} />
<Stack.Screen name="Webrtc" component={Webrtc} />
</Stack.Navigator>
</NavigationContainer>
);
}
}
const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter,
},
engine: {
position: 'absolute',
right: 0,
},
body: {
backgroundColor: Colors.white,
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black,
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
color: Colors.dark,
},
highlight: {
fontWeight: '700',
},
footer: {
color: Colors.dark,
fontSize: 12,
fontWeight: '600',
padding: 4,
paddingRight: 12,
textAlign: 'right',
},
imageHeight: {
height: 22,
width: 20,
paddingTop: 4,
},
});
export default App;

undefined is not an object (evaluating 'object.keys(routeConfigs)') [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
This is the error I am receiving. Please tell me what file you need to see. Apologies if the problem is not to the point, I am a noob here.
First image shows the error
Below is the file which calls for stack navigator.
This file calls for stacknavigator
If you need anything else, please tell me, I'll add it in further edits
import React from "react";
import { Easing, Animated, Dimensions } from "react-native";
//import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';
import { createDrawerNavigator,DrawerItems} from 'react-navigation-drawer';
//import { createBottomTabNavigator } from 'react-navigation-bottom-tabs';
import { Block } from "galio-framework";
// screens
import HomeActivity from '../components/HomeActivity.js';
import ProfileActivity from '../components/ProfileActivity.js';
import Results from '../components/Results.js';
// import HomeActivity from "../screens/Home";
// import Onboarding from "../screens/Onboarding";
import Pro from "../components/Pro";
import Profile from "../components/Profile";
// import Register from "../screens/Register";
// import Elements from "../screens/Elements";
// import Articles from "../screens/Articles";
// drawer
import CustomDrawerContent from "./Menu";
// header for screens
import Icon from "../components/Icon";
import Header from "../components/Header";
import { argonTheme, tabs } from "../constants";
const { width } = Dimensions.get("screen");
const Stack = createStackNavigator();
const Drawer = createDrawerNavigator();
//const Tab = createBottomTabNavigator();
function ElementsStack(props) {
return (
<Stack.Navigator mode="card" headerMode="screen">
<Stack.Screen
name="Elements"
component={Profile}
options={{
header: ({ navigation, scene }) => (
<Header title="Elements" navigation={navigation} scene={scene} />
),
cardStyle: { backgroundColor: "#F8F9FE" }
}}
/>
<Stack.Screen
name="Pro"
component={Pro}
options={{
header: ({ navigation, scene }) => (
<Header
title=""
back
white
transparent
navigation={navigation}
scene={scene}
/>
),
headerTransparent: true
}}
/>
</Stack.Navigator>
);
}
function ArticlesStack(props) {
return (
<Stack.Navigator mode="card" headerMode="screen">
<Stack.Screen
name="Articles"
component={Articles}
options={{
header: ({ navigation, scene }) => (
<Header title="Articles" navigation={navigation} scene={scene} />
),
cardStyle: { backgroundColor: "#F8F9FE" }
}}
/>
<Stack.Screen
name="Pro"
component={Pro}
options={{
header: ({ navigation, scene }) => (
<Header
title=""
back
white
transparent
navigation={navigation}
scene={scene}
/>
),
headerTransparent: true
}}
/>
</Stack.Navigator>
);
}
function ProfileStack(props) {
return (
<Stack.Navigator initialRouteName="Profile" mode="card" headerMode="screen">
<Stack.Screen
name="Profile"
component={ProfileActivity}
options={{
header: ({ navigation, scene }) => (
<Header
transparent
white
title="Profile"
navigation={navigation}
scene={scene}
/>
),
cardStyle: { backgroundColor: "#FFFFFF" },
headerTransparent: true
}}
/>
<Stack.Screen
name="Pro"
component={Pro}
options={{
header: ({ navigation, scene }) => (
<Header
title=""
back
white
transparent
navigation={navigation}
scene={scene}
/>
),
headerTransparent: true
}}
/>
</Stack.Navigator>
);
}
function HomeStack(props) {
return (
<Stack.Navigator mode="card" headerMode="screen">
<Stack.Screen
name="Home"
component={HomeActivity}
options={{
header: ({ navigation, scene }) => (
<Header
title="Home"
search
options
navigation={navigation}
scene={scene}
/>
),
cardStyle: { backgroundColor: "#F8F9FE" }
}}
/>
<Stack.Screen
name="Pro"
component={Pro}
options={{
header: ({ navigation, scene }) => (
<Header
title=""
back
white
transparent
navigation={navigation}
scene={scene}
/>
),
headerTransparent: true
}}
/>
</Stack.Navigator>
);
}
export default function OnboardingStack(props) {
return (
<Stack.Navigator mode="card" headerMode="none">
<Stack.Screen
name="Jobs"
component={Results}
option={{
headerTransparent: true
}}
/>
<Stack.Screen name="App" component={AppStack} />
</Stack.Navigator>
);
}
function AppStack(props) {
return (
<Drawer.Navigator
style={{ flex: 1 }}
drawerContent={props => <CustomDrawerContent {...props} />}
drawerStyle={{
backgroundColor: "white",
width: width * 0.8
}}
drawerContentOptions={{
activeTintcolor: "white",
inactiveTintColor: "#000",
activeBackgroundColor: "transparent",
itemStyle: {
width: width * 0.75,
backgroundColor: "transparent",
paddingVertical: 16,
paddingHorizonal: 12,
justifyContent: "center",
alignContent: "center",
alignItems: "center",
overflow: "hidden"
},
labelStyle: {
fontSize: 18,
marginLeft: 12,
fontWeight: "normal"
}
}}
initialRouteName="Home"
>
<Drawer.Screen name="Home" component={HomeStack} />
<Drawer.Screen name="Profile" component={ProfileStack} />
<Drawer.Screen name="Results" component={OnboardingStack} />
<Drawer.Screen name="Elements" component={ElementsStack} />
{/* <Drawer.Screen name="Articles" component={ArticlesStack} /> */}
</Drawer.Navigator>
);
}
So based on the error i would say that validateRouteConfigMap.js is getting an object(routeConfigs) that you've not yet defined or passed in as undefined or you have not set a default value for. Remember Object.keys(ARRAY_OR_OBJECT_VARIABLE) requires a variable of object type (besides null)