Skip to content

Commit bf9be8e

Browse files
committed
faet: add back button in settings page.
1 parent 0e3ed8c commit bf9be8e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.changeset/new-clouds-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"xlog": patch
3+
---
4+
5+
Add back button in settings page.

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"git.ignoreLimitWarning": true,
2222
"prettier.enable": false,
2323
"editor.codeActionsOnSave": {
24-
"source.fixAll.eslint": true
24+
"source.fixAll.eslint": "explicit"
2525
},
2626
"eslint.format.enable": true,
2727
"editor.defaultFormatter": "dbaeumer.vscode-eslint"

src/navigation/settings.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import type { FC } from "react";
12
import React from "react";
23
import { useTranslation } from "react-i18next";
34

5+
import { HeaderBackButton } from "@react-navigation/elements";
6+
import type { NativeStackScreenProps } from "@react-navigation/native-stack";
47
import { createNativeStackNavigator } from "@react-navigation/native-stack";
58

69
import { Advanced } from "@/pages/Advanced";
@@ -10,7 +13,7 @@ import type { SettingsStackParamList } from "./types";
1013

1114
const SettingsStack = createNativeStackNavigator<SettingsStackParamList>();
1215

13-
export const SettingsNavigator = () => {
16+
export const SettingsNavigator: FC<NativeStackScreenProps<SettingsStackParamList, "Settings">> = ({ navigation }) => {
1417
const i18n = useTranslation("common");
1518

1619
return (
@@ -19,16 +22,17 @@ export const SettingsNavigator = () => {
1922
name={"Settings"}
2023
component={Settings}
2124
options={{
25+
headerLeft: props => <HeaderBackButton {...props} onPress={navigation.goBack} />,
2226
title: i18n.t("Settings"),
23-
headerBackTitleVisible: false,
2427
}}
2528
/>
2629
<SettingsStack.Screen
2730
name={"Advanced"}
2831
component={Advanced}
2932
options={{
30-
title: i18n.t("Advanced"),
33+
headerBackVisible: true,
3134
headerBackTitleVisible: false,
35+
title: i18n.t("Advanced"),
3236
}}
3337
/>
3438
</SettingsStack.Navigator>

0 commit comments

Comments
 (0)