blob: b655dde000fc18d4e900f34057bd335f768608a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import {useCallback} from 'react'
import {SystemBars} from 'react-native-edge-to-edge'
import {isIOS} from '#/platform/detection'
/**
* If we're calling a system API like the image picker that opens a sheet
* wrap it in this function to make sure the status bar is the correct color.
*/
export function useSheetWrapper() {
return useCallback(async <T>(promise: Promise<T>): Promise<T> => {
if (isIOS) {
const entry = SystemBars.pushStackEntry({
style: {
statusBar: 'light',
},
})
const res = await promise
SystemBars.popStackEntry(entry)
return res
} else {
return await promise
}
}, [])
}
|