diff options
author | Mathieu Acthernoene <zoontek@gmail.com> | 2025-04-22 18:16:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-22 19:16:50 +0300 |
commit | a770f5635b549f2a87ffeaedd031dfe8e37b58c8 (patch) | |
tree | 2e935d294227e57b2e81ba79ba96a6a85f268971 /src/components/Dialog | |
parent | 6e80b340c825900524bfe981ba29cfd0c6cf5934 (diff) | |
download | voidsky-a770f5635b549f2a87ffeaedd031dfe8e37b58c8.tar.zst |
Edge to edge support (#7497)
Diffstat (limited to 'src/components/Dialog')
-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 + } + }, []) } |