Fix form keyboard issues and sticky footers in agent screens
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
DarkTheme,
|
||||
NavigationContainer,
|
||||
} from '@react-navigation/native';
|
||||
|
||||
import { useAppSelector } from '../app/hooks';
|
||||
import { selectAuthHydrating, selectIsAuthenticated, selectAuthRole } from '../modules/auth/store/authSelectors';
|
||||
import { useTheme } from '../theme';
|
||||
import { AuthNavigator } from './AuthNavigator';
|
||||
import { MainTabNavigator } from './MainTabNavigator';
|
||||
import { EmployeeNavigator } from './EmployeeNavigator';
|
||||
import { AgentNavigator } from './AgentNavigator';
|
||||
|
||||
export const RootNavigator = () => {
|
||||
const theme = useTheme();
|
||||
const isHydrating = useAppSelector(selectAuthHydrating);
|
||||
const isAuthenticated = useAppSelector(selectIsAuthenticated);
|
||||
const role = useAppSelector(selectAuthRole);
|
||||
|
||||
const renderAppStack = () => {
|
||||
switch (role) {
|
||||
case 'Employee':
|
||||
return <EmployeeNavigator />;
|
||||
case 'Agent':
|
||||
return <AgentNavigator />;
|
||||
case 'User':
|
||||
default:
|
||||
return <MainTabNavigator />;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<NavigationContainer
|
||||
theme={{
|
||||
...DarkTheme,
|
||||
colors: {
|
||||
...DarkTheme.colors,
|
||||
background: theme.colors.background,
|
||||
card: theme.colors.backgroundElevated,
|
||||
text: theme.colors.textPrimary,
|
||||
primary: theme.colors.accent,
|
||||
border: theme.colors.cardBorder,
|
||||
notification: theme.colors.accent,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{isAuthenticated ? renderAppStack() : <AuthNavigator />}
|
||||
</NavigationContainer>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user