|
|
|
@ -4,9 +4,13 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack";
|
|
|
|
|
import { RootStackParamList } from './types'; |
|
|
|
|
import * as Screens from './screens'; |
|
|
|
|
import Toast from "react-native-toast-message"; |
|
|
|
|
import { View, Text, Dimensions } from 'react-native'; |
|
|
|
|
|
|
|
|
|
const Stack = createNativeStackNavigator<RootStackParamList>(); |
|
|
|
|
|
|
|
|
|
// 获取屏幕尺寸
|
|
|
|
|
const { height: screenHeight } = Dimensions.get('window'); |
|
|
|
|
|
|
|
|
|
// 获取当前路由信息的工具函数
|
|
|
|
|
// [DEBUG-ROUTER-LOGGER] 路由跟踪函数 - 生产环境可删除
|
|
|
|
|
const getActiveRouteName = (state: NavigationState | PartialState<NavigationState> | undefined): string => { |
|
|
|
@ -425,7 +429,103 @@ export const AppNavigator = () => {
|
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</Stack.Navigator> |
|
|
|
|
<Toast /> |
|
|
|
|
<Toast
|
|
|
|
|
config={{ |
|
|
|
|
success: (props) => ( |
|
|
|
|
<View style={{ |
|
|
|
|
backgroundColor: '#000000', |
|
|
|
|
paddingHorizontal: 20, |
|
|
|
|
paddingVertical: 12, |
|
|
|
|
borderRadius: 8, |
|
|
|
|
marginHorizontal: 20, |
|
|
|
|
alignItems: 'center', |
|
|
|
|
justifyContent: 'center', |
|
|
|
|
}}> |
|
|
|
|
<Text style={{ |
|
|
|
|
color: '#FFFFFF', |
|
|
|
|
fontSize: 16, |
|
|
|
|
textAlign: 'center', |
|
|
|
|
}}> |
|
|
|
|
{props.text1} |
|
|
|
|
</Text> |
|
|
|
|
{props.text2 && ( |
|
|
|
|
<Text style={{ |
|
|
|
|
color: '#FFFFFF', |
|
|
|
|
fontSize: 14, |
|
|
|
|
textAlign: 'center', |
|
|
|
|
marginTop: 4, |
|
|
|
|
opacity: 0.8, |
|
|
|
|
}}> |
|
|
|
|
{props.text2} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
), |
|
|
|
|
error: (props) => ( |
|
|
|
|
<View style={{ |
|
|
|
|
backgroundColor: '#000000', |
|
|
|
|
paddingHorizontal: 20, |
|
|
|
|
paddingVertical: 12, |
|
|
|
|
borderRadius: 8, |
|
|
|
|
marginHorizontal: 20, |
|
|
|
|
alignItems: 'center', |
|
|
|
|
justifyContent: 'center', |
|
|
|
|
}}> |
|
|
|
|
<Text style={{ |
|
|
|
|
color: '#FFFFFF', |
|
|
|
|
fontSize: 16, |
|
|
|
|
textAlign: 'center', |
|
|
|
|
}}> |
|
|
|
|
{props.text1} |
|
|
|
|
</Text> |
|
|
|
|
{props.text2 && ( |
|
|
|
|
<Text style={{ |
|
|
|
|
color: '#FFFFFF', |
|
|
|
|
fontSize: 14, |
|
|
|
|
textAlign: 'center', |
|
|
|
|
marginTop: 4, |
|
|
|
|
opacity: 0.8, |
|
|
|
|
}}> |
|
|
|
|
{props.text2} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
), |
|
|
|
|
info: (props) => ( |
|
|
|
|
<View style={{ |
|
|
|
|
backgroundColor: '#000000', |
|
|
|
|
paddingHorizontal: 20, |
|
|
|
|
paddingVertical: 12, |
|
|
|
|
borderRadius: 8, |
|
|
|
|
marginHorizontal: 20, |
|
|
|
|
alignItems: 'center', |
|
|
|
|
justifyContent: 'center', |
|
|
|
|
}}> |
|
|
|
|
<Text style={{ |
|
|
|
|
color: '#FFFFFF', |
|
|
|
|
fontSize: 16, |
|
|
|
|
textAlign: 'center', |
|
|
|
|
}}> |
|
|
|
|
{props.text1} |
|
|
|
|
</Text> |
|
|
|
|
{props.text2 && ( |
|
|
|
|
<Text style={{ |
|
|
|
|
color: '#FFFFFF', |
|
|
|
|
fontSize: 14, |
|
|
|
|
textAlign: 'center', |
|
|
|
|
marginTop: 4, |
|
|
|
|
opacity: 0.8, |
|
|
|
|
}}> |
|
|
|
|
{props.text2} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
), |
|
|
|
|
}} |
|
|
|
|
position="top" |
|
|
|
|
topOffset={screenHeight / 2 - 50} |
|
|
|
|
visibilityTime={3000} |
|
|
|
|
/> |
|
|
|
|
</NavigationContainer> |
|
|
|
|
); |
|
|
|
|
};
|