Skip to content

Commit 5bdd37e

Browse files
committed
fix: clear forceInset for non-translucent status bar screens
1 parent 8839062 commit 5bdd37e

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

routes.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { Icon } from 'react-native-elements';
1010

1111
import { NotificationIcon } from 'components';
12-
import { colors } from 'config';
12+
import { colors, getHeaderForceInset } from 'config';
1313
import { t } from 'utils';
1414

1515
// Auth
@@ -222,12 +222,33 @@ const sharedRoutes = {
222222
},
223223
};
224224

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+
225245
const HomeStackNavigator = StackNavigator(
226246
{
227247
Events: {
228248
screen: EventsScreen,
229249
navigationOptions: {
230250
headerTitle: 'GitPoint',
251+
headerForceInset: getHeaderForceInset('Events'),
231252
},
232253
},
233254
...sharedRoutes,

src/config/status-bar.js

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ export const getStatusBarConfig = routeName =>
2424
lightScreens.includes(routeName)
2525
? getLightStatusBar(routeName)
2626
: darkStatusBar;
27+
28+
export const getHeaderForceInset = routeName =>
29+
lightScreens.includes(routeName) ? { top: 'always', bottom: 'never' } : {};

0 commit comments

Comments
 (0)