Front: Settings Navigator: Allow passing screen name as props
This commit is contained in:
@@ -89,8 +89,7 @@ const ProfileView = () => {
|
|||||||
<PlayerStats/>
|
<PlayerStats/>
|
||||||
<Box w="10%" paddingY={10} paddingLeft={5} paddingRight={50} zIndex={1}>
|
<Box w="10%" paddingY={10} paddingLeft={5} paddingRight={50} zIndex={1}>
|
||||||
<TextButton
|
<TextButton
|
||||||
onPress={() => navigation.navigate('Settings')}
|
onPress={() => navigation.navigate('Settings', { screen: 'Profile' })}
|
||||||
style={{margin: 10}}
|
|
||||||
translate={{ translationKey: 'settingsBtn' }}
|
translate={{ translationKey: 'settingsBtn' }}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</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 userQuery = useQuery(['user'], () => API.getUserInfo());
|
||||||
const user = useMemo(() => userQuery.data, [userQuery]);
|
const user = useMemo(() => userQuery.data, [userQuery]);
|
||||||
|
|
||||||
@@ -83,7 +94,7 @@ const SetttingsNavigator = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
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
|
{/* 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 */}
|
wanted settings page if needed so I need to do special work with the 0 index */}
|
||||||
<TabRow.Screen name='InternalDefault' component={Box} />
|
<TabRow.Screen name='InternalDefault' component={Box} />
|
||||||
|
|||||||
Reference in New Issue
Block a user