Front: Settings Navigator: Allow passing screen name as props
This commit is contained in:
@@ -89,8 +89,7 @@ const ProfileView = () => {
|
||||
<PlayerStats/>
|
||||
<Box w="10%" paddingY={10} paddingLeft={5} paddingRight={50} zIndex={1}>
|
||||
<TextButton
|
||||
onPress={() => navigation.navigate('Settings')}
|
||||
style={{margin: 10}}
|
||||
onPress={() => navigation.navigate('Settings', { screen: 'Profile' })}
|
||||
translate={{ translationKey: 'settingsBtn' }}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user