Skip to content

Commit e896154

Browse files
committed
fixed: useStackNavigatorScreenOptions usage
1 parent fc28f58 commit e896154

14 files changed

+874
-785
lines changed

src/navigation/navigators/AccountNavigator.js

Lines changed: 74 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,80 +5,84 @@ import screens, { headerLeft } from '..';
55
import i18n from '../../i18n';
66
import AccountRegisterConfirm from '../account/RegisterConfirm';
77
import AccountResetPasswordNewPassword from '../account/ResetPasswordNewPassword';
8-
import { stackNavigatorScreenOptions } from '../styles';
8+
import { useStackNavigatorScreenOptions } from '../styles';
99

1010
const Stack = createStackNavigator();
1111

1212
export const AccountRegisterConfirmScreen = 'AccountRegisterConfirm';
1313
export const AccountResetPasswordNewPasswordScreen =
1414
'AccountResetPasswordNewPassword';
1515

16-
export default () => (
17-
<Stack.Navigator screenOptions={stackNavigatorScreenOptions}>
18-
<Stack.Screen
19-
name="AccountHome"
20-
component={screens.AccountHome}
21-
options={({ navigation }) => ({
22-
title: i18n.t('MY_ACCOUNT'),
23-
headerLeft: headerLeft(navigation),
24-
})}
25-
/>
26-
{/*FIXME: AccountAddresses and AddressDetails also exist in CheckoutNavigator, get rid from this duplication */}
27-
<Stack.Screen
28-
name="AccountAddresses"
29-
component={screens.AccountAddressesPage}
30-
options={{
31-
title: i18n.t('MY_ADDRESSES'),
32-
}}
33-
/>
34-
<Stack.Screen
35-
name="AddressDetails"
36-
component={screens.AddressDetails}
37-
options={{
38-
title: i18n.t('MY_ADDRESSES'),
39-
}}
40-
/>
41-
<Stack.Screen
42-
name="AccountDetails"
43-
component={screens.AccountDetailsPage}
44-
options={{
45-
title: i18n.t('MY_DETAILS'),
46-
}}
47-
/>
48-
<Stack.Screen
49-
name="AccountRegisterCheckEmail"
50-
component={screens.AccountRegisterCheckEmail}
51-
options={{
52-
title: i18n.t('REGISTER_CHECK_EMAIL'),
53-
}}
54-
/>
55-
<Stack.Screen
56-
name={AccountRegisterConfirmScreen}
57-
component={AccountRegisterConfirm}
58-
options={{
59-
title: i18n.t('REGISTER_CONFIRM'),
60-
}}
61-
/>
62-
<Stack.Screen
63-
name="AccountForgotPassword"
64-
component={screens.AccountForgotPassword}
65-
options={{
66-
title: i18n.t('FORGOT_PASSWORD'),
67-
}}
68-
/>
69-
<Stack.Screen
70-
name="AccountResetPasswordCheckEmail"
71-
component={screens.AccountResetPasswordCheckEmail}
72-
options={{
73-
title: i18n.t('RESET_PASSWORD_CHECK_EMAIL'),
74-
}}
75-
/>
76-
<Stack.Screen
77-
name={AccountResetPasswordNewPasswordScreen}
78-
component={AccountResetPasswordNewPassword}
79-
options={{
80-
title: i18n.t('RESET_PASSWORD_NEW_PASSWORD'),
81-
}}
82-
/>
83-
</Stack.Navigator>
84-
);
16+
export default () => {
17+
const screenOptions = useStackNavigatorScreenOptions();
18+
19+
return (
20+
<Stack.Navigator screenOptions={screenOptions}>
21+
<Stack.Screen
22+
name="AccountHome"
23+
component={screens.AccountHome}
24+
options={({ navigation }) => ({
25+
title: i18n.t('MY_ACCOUNT'),
26+
headerLeft: headerLeft(navigation),
27+
})}
28+
/>
29+
{/*FIXME: AccountAddresses and AddressDetails also exist in CheckoutNavigator, get rid from this duplication */}
30+
<Stack.Screen
31+
name="AccountAddresses"
32+
component={screens.AccountAddressesPage}
33+
options={{
34+
title: i18n.t('MY_ADDRESSES'),
35+
}}
36+
/>
37+
<Stack.Screen
38+
name="AddressDetails"
39+
component={screens.AddressDetails}
40+
options={{
41+
title: i18n.t('MY_ADDRESSES'),
42+
}}
43+
/>
44+
<Stack.Screen
45+
name="AccountDetails"
46+
component={screens.AccountDetailsPage}
47+
options={{
48+
title: i18n.t('MY_DETAILS'),
49+
}}
50+
/>
51+
<Stack.Screen
52+
name="AccountRegisterCheckEmail"
53+
component={screens.AccountRegisterCheckEmail}
54+
options={{
55+
title: i18n.t('REGISTER_CHECK_EMAIL'),
56+
}}
57+
/>
58+
<Stack.Screen
59+
name={AccountRegisterConfirmScreen}
60+
component={AccountRegisterConfirm}
61+
options={{
62+
title: i18n.t('REGISTER_CONFIRM'),
63+
}}
64+
/>
65+
<Stack.Screen
66+
name="AccountForgotPassword"
67+
component={screens.AccountForgotPassword}
68+
options={{
69+
title: i18n.t('FORGOT_PASSWORD'),
70+
}}
71+
/>
72+
<Stack.Screen
73+
name="AccountResetPasswordCheckEmail"
74+
component={screens.AccountResetPasswordCheckEmail}
75+
options={{
76+
title: i18n.t('RESET_PASSWORD_CHECK_EMAIL'),
77+
}}
78+
/>
79+
<Stack.Screen
80+
name={AccountResetPasswordNewPasswordScreen}
81+
component={AccountResetPasswordNewPassword}
82+
options={{
83+
title: i18n.t('RESET_PASSWORD_NEW_PASSWORD'),
84+
}}
85+
/>
86+
</Stack.Navigator>
87+
);
88+
};

0 commit comments

Comments
 (0)