diff options
Diffstat (limited to 'src/components/Dialog/sheet-wrapper.ts')
-rw-r--r-- | src/components/Dialog/sheet-wrapper.ts | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/components/Dialog/sheet-wrapper.ts b/src/components/Dialog/sheet-wrapper.ts index 37c663383..b655dde00 100644 --- a/src/components/Dialog/sheet-wrapper.ts +++ b/src/components/Dialog/sheet-wrapper.ts @@ -1,20 +1,25 @@ import {useCallback} from 'react' +import {SystemBars} from 'react-native-edge-to-edge' -import {useDialogStateControlContext} from '#/state/dialogs' +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() { - const {setFullyExpandedCount} = useDialogStateControlContext() - return useCallback( - async <T>(promise: Promise<T>): Promise<T> => { - setFullyExpandedCount(c => c + 1) + return useCallback(async <T>(promise: Promise<T>): Promise<T> => { + if (isIOS) { + const entry = SystemBars.pushStackEntry({ + style: { + statusBar: 'light', + }, + }) const res = await promise - setFullyExpandedCount(c => c - 1) + SystemBars.popStackEntry(entry) return res - }, - [setFullyExpandedCount], - ) + } else { + return await promise + } + }, []) } |