65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
import {NavigationContainer} from '@react-navigation/native';
|
|
import {createNativeStackNavigator} from '@react-navigation/native-stack';
|
|
import {LoginScreen} from '../screens/auth/LoginScreen';
|
|
import {HomeScreen} from '../screens/home/HomeScreen';
|
|
import {StockInEmpty} from '../screens/stockIn/StockInEmpty';
|
|
import StockInWheelManual from '../screens/stockIn/StockInWheelManual';
|
|
import {RootStackParamList} from './types';
|
|
import {Platform} from 'react-native';
|
|
import {screensEnabled, enableScreens} from 'react-native-screens';
|
|
|
|
// 确保 react-native-screens 在导航之前初始化
|
|
if (Platform.OS === 'android' && !screensEnabled()) {
|
|
enableScreens(false);
|
|
}
|
|
|
|
const Stack = createNativeStackNavigator<RootStackParamList>();
|
|
|
|
const Navigation = () => {
|
|
|
|
return (
|
|
<NavigationContainer>
|
|
<Stack.Navigator
|
|
initialRouteName="Login"
|
|
screenOptions={{
|
|
headerShown: false,
|
|
animation: Platform.OS === 'android' ? 'none' : 'default',
|
|
gestureEnabled: Platform.OS !== 'android',
|
|
animationTypeForReplace: 'pop',
|
|
}}>
|
|
<Stack.Screen
|
|
name="Login"
|
|
component={LoginScreen}
|
|
options={{
|
|
animation: 'none',
|
|
}}
|
|
/>
|
|
<Stack.Screen
|
|
name="Home"
|
|
component={HomeScreen}
|
|
options={{
|
|
animation: 'none',
|
|
}}
|
|
/>
|
|
<Stack.Screen
|
|
name="StockInEmpty"
|
|
component={StockInEmpty}
|
|
options={{
|
|
animation: 'none',
|
|
}}
|
|
/>
|
|
<Stack.Screen
|
|
name="StockInWheelManual"
|
|
component={StockInWheelManual}
|
|
options={{
|
|
animation: 'none',
|
|
}}
|
|
/>
|
|
</Stack.Navigator>
|
|
</NavigationContainer>
|
|
);
|
|
};
|
|
|
|
export default Navigation;
|