File tree 4 files changed +44
-6
lines changed
4 files changed +44
-6
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,7 @@ export default function Root() {
20
20
return (
21
21
< View style = { styles . stackWrapper } >
22
22
< Stack . Navigator
23
- screenOptions = { ( { navigation } ) => ( {
24
- detachPreviousScreen : ! navigation . isFocused ( ) ,
23
+ screenOptions = { ( ) => ( {
25
24
cardStyleInterpolator,
26
25
header : ( { navigation, route, options, back } ) => (
27
26
< Appbar . Header elevated >
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
CombinedDefaultTheme ,
29
29
CombinedDarkTheme ,
30
30
createConfiguredFontTheme ,
31
+ createConfiguredFontNavigationTheme ,
31
32
} from '../utils/themes' ;
32
33
33
34
const PERSISTENCE_KEY = 'NAVIGATION_STATE' ;
@@ -192,6 +193,8 @@ export default function PaperExample() {
192
193
193
194
const combinedTheme = isDarkMode ? CombinedDarkTheme : CombinedDefaultTheme ;
194
195
const configuredFontTheme = createConfiguredFontTheme ( combinedTheme ) ;
196
+ const configuredFontNavigationTheme =
197
+ createConfiguredFontNavigationTheme ( combinedTheme ) ;
195
198
196
199
return (
197
200
< PaperProvider
@@ -200,8 +203,9 @@ export default function PaperExample() {
200
203
>
201
204
< PreferencesContext . Provider value = { preferences } >
202
205
< NavigationContainer
203
- // @ts -ignore - will be adjusted after merging https://github.com/callstack/react-native-paper/pull/4690
204
- theme = { combinedTheme }
206
+ theme = {
207
+ customFontLoaded ? configuredFontNavigationTheme : combinedTheme
208
+ }
205
209
initialState = { initialState }
206
210
onStateChange = { ( state ) =>
207
211
AsyncStorage . setItem ( PERSISTENCE_KEY , JSON . stringify ( state ) )
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import App from './RootNavigator';
22
22
import {
23
23
CombinedDarkTheme ,
24
24
CombinedDefaultTheme ,
25
+ createConfiguredFontNavigationTheme ,
25
26
createConfiguredFontTheme ,
26
27
} from '../utils/themes' ;
27
28
@@ -149,6 +150,8 @@ export default function PaperExample() {
149
150
150
151
const combinedTheme = isDarkMode ? CombinedDarkTheme : CombinedDefaultTheme ;
151
152
const configuredFontTheme = createConfiguredFontTheme ( combinedTheme ) ;
153
+ const configuredFontNavigationTheme =
154
+ createConfiguredFontNavigationTheme ( combinedTheme ) ;
152
155
153
156
return (
154
157
< PaperProvider
@@ -157,8 +160,9 @@ export default function PaperExample() {
157
160
>
158
161
< PreferencesContext . Provider value = { preferences } >
159
162
< NavigationContainer
160
- // @ts -ignore - will be adjusted after merging https://github.com/callstack/react-native-paper/pull/4690
161
- theme = { combinedTheme }
163
+ theme = {
164
+ customFontLoaded ? configuredFontNavigationTheme : combinedTheme
165
+ }
162
166
initialState = { initialState }
163
167
onStateChange = { ( state ) =>
164
168
AsyncStorage . setItem ( PERSISTENCE_KEY , JSON . stringify ( state ) )
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ export const CombinedDefaultTheme = {
21
21
...MD3LightTheme . colors ,
22
22
...LightTheme . colors ,
23
23
} ,
24
+ fonts : {
25
+ ...MD3LightTheme . fonts ,
26
+ ...LightTheme . fonts ,
27
+ } ,
24
28
} ;
25
29
26
30
export const CombinedDarkTheme = {
@@ -30,6 +34,10 @@ export const CombinedDarkTheme = {
30
34
...MD3DarkTheme . colors ,
31
35
...DarkTheme . colors ,
32
36
} ,
37
+ fonts : {
38
+ ...MD3DarkTheme . fonts ,
39
+ ...DarkTheme . fonts ,
40
+ } ,
33
41
} ;
34
42
35
43
type CombinedTheme = typeof CombinedDefaultTheme ;
@@ -42,3 +50,26 @@ export const createConfiguredFontTheme = (theme: CombinedTheme) => ({
42
50
} ,
43
51
} ) ,
44
52
} ) ;
53
+
54
+ export const createConfiguredFontNavigationTheme = ( theme : CombinedTheme ) => ( {
55
+ ...theme ,
56
+ fonts : {
57
+ ...theme . fonts ,
58
+ regular : {
59
+ ...theme . fonts . regular ,
60
+ fontFamily : 'Abel' ,
61
+ } ,
62
+ medium : {
63
+ ...theme . fonts . medium ,
64
+ fontFamily : 'Abel' ,
65
+ } ,
66
+ heavy : {
67
+ ...theme . fonts . heavy ,
68
+ fontFamily : 'Abel' ,
69
+ } ,
70
+ bold : {
71
+ ...theme . fonts . bold ,
72
+ fontFamily : 'Abel' ,
73
+ } ,
74
+ } ,
75
+ } ) ;
You can’t perform that action at this time.
0 commit comments