File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 9
9
import { Icon } from 'react-native-elements' ;
10
10
11
11
import { NotificationIcon } from 'components' ;
12
- import { colors } from 'config' ;
12
+ import { colors , getHeaderForceInset } from 'config' ;
13
13
import { t } from 'utils' ;
14
14
15
15
// Auth
@@ -222,12 +222,33 @@ const sharedRoutes = {
222
222
} ,
223
223
} ;
224
224
225
+ Object . keys ( sharedRoutes ) . forEach ( routeName => {
226
+ const { navigationOptions } = sharedRoutes [ routeName ] ;
227
+
228
+ if ( navigationOptions . header !== null ) {
229
+ // fix headerForceInset if the header is not disabled
230
+ const headerForceInset = getHeaderForceInset ( routeName ) ;
231
+
232
+ if ( typeof navigationOptions === 'function' ) {
233
+ const fn = navigationOptions ;
234
+
235
+ sharedRoutes [ routeName ] . navigationOptions = ( ...args ) => ( {
236
+ ...fn ( ...args ) ,
237
+ headerForceInset,
238
+ } ) ;
239
+ } else {
240
+ navigationOptions . headerForceInset = headerForceInset ;
241
+ }
242
+ }
243
+ } ) ;
244
+
225
245
const HomeStackNavigator = StackNavigator (
226
246
{
227
247
Events : {
228
248
screen : EventsScreen ,
229
249
navigationOptions : {
230
250
headerTitle : 'GitPoint' ,
251
+ headerForceInset : getHeaderForceInset ( 'Events' ) ,
231
252
} ,
232
253
} ,
233
254
...sharedRoutes ,
Original file line number Diff line number Diff line change @@ -24,3 +24,6 @@ export const getStatusBarConfig = routeName =>
24
24
lightScreens . includes ( routeName )
25
25
? getLightStatusBar ( routeName )
26
26
: darkStatusBar ;
27
+
28
+ export const getHeaderForceInset = routeName =>
29
+ lightScreens . includes ( routeName ) ? { top : 'always' , bottom : 'never' } : { } ;
You can’t perform that action at this time.
0 commit comments