|
|
@@ -7,7 +7,7 @@ import { Pressable } from 'react-native';
|
|
|
import { NavigationContainer } from '@react-navigation/native';
|
|
|
import { createStackNavigator, TransitionPresets } from '@react-navigation/stack';
|
|
|
import { enableScreens } from 'react-native-screens';
|
|
|
-import { Styles } from '../components/Toolbar';
|
|
|
+import { BackButton, Styles } from '../components/Toolbar';
|
|
|
import app from '../../app.json';
|
|
|
import About from './about/About';
|
|
|
import Launcher from './Launch';
|
|
|
@@ -372,6 +372,7 @@ const Title = (title, opt = {}, titleScope) => {
|
|
|
} else {
|
|
|
options.title = title
|
|
|
}
|
|
|
+ options.headerLeft = () => <BackButton/>
|
|
|
return options;
|
|
|
}
|
|
|
|
|
|
@@ -406,14 +407,14 @@ const Router = () => {
|
|
|
useEffect(() => {
|
|
|
//注入全局方法
|
|
|
global.startPage = (name, params = {}) => {
|
|
|
- navigation.current.navigate(name, params);
|
|
|
+ navigation.current?.navigate(name, params);
|
|
|
}
|
|
|
global.dispatchPage = (params) => {
|
|
|
- navigation.current.dispatch(params);
|
|
|
+ navigation.current?.dispatch(params);
|
|
|
}
|
|
|
global.goBack = () => {
|
|
|
- if (navigation.current.canGoBack()) {
|
|
|
- navigation.current.goBack();
|
|
|
+ if (navigation.current?.canGoBack()) {
|
|
|
+ navigation.current?.goBack();
|
|
|
} else {
|
|
|
startPage(PageList.home);
|
|
|
}
|