From 87dab44ad063a93a9f362dc2f8e97e47eec49e31 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Fri, 9 Jun 2023 11:51:17 +0100 Subject: [PATCH] Front: Settings Navigator: Allow passing screen name as props --- front/views/ProfileView.tsx | 3 +-- front/views/settings/SettingsView.tsx | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/front/views/ProfileView.tsx b/front/views/ProfileView.tsx index 4de4f14..0a18629 100644 --- a/front/views/ProfileView.tsx +++ b/front/views/ProfileView.tsx @@ -89,8 +89,7 @@ const ProfileView = () => { navigation.navigate('Settings')} - style={{margin: 10}} + onPress={() => navigation.navigate('Settings', { screen: 'Profile' })} translate={{ translationKey: 'settingsBtn' }} /> diff --git a/front/views/settings/SettingsView.tsx b/front/views/settings/SettingsView.tsx index f4c4f45..9283bc6 100644 --- a/front/views/settings/SettingsView.tsx +++ b/front/views/settings/SettingsView.tsx @@ -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 ( - + {/* 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 */}