Skip to content

Commit 8a292f3

Browse files
fix: workaround for android statusbar
1 parent bfb80c2 commit 8a292f3

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"dependencies": {
1515
"expo": "^49.0.11",
1616
"expo-splash-screen": "~0.20.5",
17+
"expo-status-bar": "~1.6.0",
1718
"react": "18.2.0",
1819
"react-dom": "18.2.0",
1920
"react-native": "0.72.6",

example/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ function App({
192192
return (
193193
<>
194194
<StatusBar
195-
// barStyle="light-content"
196-
// backgroundColor={theme.colors.primary}
197-
translucent={true}
195+
barStyle={'dark-content'}
196+
translucent
197+
backgroundColor={'transparent'}
198198
/>
199199
<ScrollView
200200
style={{ backgroundColor: theme.colors.background }}

example/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4205,6 +4205,11 @@ expo-splash-screen@~0.20.5:
42054205
dependencies:
42064206
"@expo/prebuild-config" "6.2.6"
42074207

4208+
expo-status-bar@~1.6.0:
4209+
version "1.6.0"
4210+
resolved "https://registry.npmjs.org/expo-status-bar/-/expo-status-bar-1.6.0.tgz#e79ffdb9a84d2e0ec9a0dc7392d9ab364fefa9cf"
4211+
integrity sha512-e//Oi2WPdomMlMDD3skE4+1ZarKCJ/suvcB4Jo/nO427niKug5oppcPNYO+csR6y3ZglGuypS+3pp/hJ+Xp6fQ==
4212+
42084213
expo@^49.0.11:
42094214
version "49.0.11"
42104215
resolved "https://registry.yarnpkg.com/expo/-/expo-49.0.11.tgz#2ad565aaf0e4533c17e5dcbe0e0020da856cbca9"

src/Date/DatePickerModalStatusBar.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react'
22
import { useSafeAreaInsets } from 'react-native-safe-area-context'
33
import { useHeaderBackgroundColor } from '../utils'
44
import Color from 'color'
5-
import { Platform, Animated, StatusBar, StatusBarStyle } from 'react-native'
5+
import { Animated, StatusBar, StatusBarStyle } from 'react-native'
66

77
function DatePickerModalStatusBar({
88
disableSafeTop,
@@ -17,26 +17,16 @@ function DatePickerModalStatusBar({
1717
const headerBackgroundColor = useHeaderBackgroundColor()
1818
const onDarkBackground =
1919
Color(headerBackgroundColor).isDark() || statusBarOnTopOfBackdrop
20+
2021
const statusBarTheme: StatusBarStyle = onDarkBackground
2122
? 'light-content'
2223
: 'dark-content'
2324
const statusBarBackground = statusBarOnTopOfBackdrop
2425
? 'transparent'
25-
: Platform.select({
26-
android: headerBackgroundColor,
27-
ios: headerBackgroundColor,
28-
web: headerBackgroundColor,
29-
})
26+
: headerBackgroundColor
3027

3128
return (
3229
<>
33-
{!disableStatusBar && (
34-
<StatusBar
35-
barStyle={statusBarTheme}
36-
backgroundColor={statusBarBackground}
37-
translucent={true}
38-
/>
39-
)}
4030
{!disableSafeTop && !statusBarOnTopOfBackdrop && (
4131
<Animated.View
4232
style={[
@@ -47,6 +37,13 @@ function DatePickerModalStatusBar({
4737
]}
4838
/>
4939
)}
40+
{!disableStatusBar && (
41+
<StatusBar
42+
barStyle={statusBarTheme}
43+
translucent={true}
44+
backgroundColor="transparent"
45+
/>
46+
)}
5047
</>
5148
)
5249
}

0 commit comments

Comments
 (0)