Front: Settings Navigator: Allow passing screen name as props

This commit is contained in:
Arthur Jamet
2023-06-09 11:51:17 +01:00
parent 242e67edaa
commit 87dab44ad0
2 changed files with 15 additions and 5 deletions
+14 -3
View File
@@ -68,9 +68,20 @@ export const PianoSettingsView = () => {
)
}
const TabRow = createTabRowNavigator();
const TabRow = createTabRowNavigator();
const SetttingsNavigator = () => {
type SetttingsNavigatorProps = {
screen?: 'Profile' |
'Preferences' |
'Notifications' |
'Privacy' |
'ChangePassword' |
'ChangeEmail' |
'GoogleAccount' |
'PianoSettings'
}
const SetttingsNavigator = (props?: SetttingsNavigatorProps) => {
const userQuery = useQuery(['user'], () => API.getUserInfo());
const user = useMemo(() => userQuery.data, [userQuery]);
@@ -83,7 +94,7 @@ const SetttingsNavigator = () => {
}
return (
<TabRow.Navigator initialRouteName='InternalDefault' contentStyle={{}} tabBarStyle={{}}>
<TabRow.Navigator initialRouteName={props?.screen ?? 'InternalDefault'} contentStyle={{}} tabBarStyle={{}}>
{/* I'm doing this to be able to land on the summary of settings when clicking on settings and directly to the
wanted settings page if needed so I need to do special work with the 0 index */}
<TabRow.Screen name='InternalDefault' component={Box} />