Files
bsky-social-app/src/components/Dialog/sheet-wrapper.ts
T
Eric Bailey 0589bd7d9e Move /platform/detection vars into /env (#9707)
* Add platform vars to env

* Replace /platform/detection with /env
2026-01-16 16:28:17 -06:00

26 lines
660 B
TypeScript

import {useCallback} from 'react'
import {SystemBars} from 'react-native-edge-to-edge'
import {IS_IOS} from '#/env'
/**
* 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 (IS_IOS) {
const entry = SystemBars.pushStackEntry({
style: {
statusBar: 'light',
},
})
const res = await promise
SystemBars.popStackEntry(entry)
return res
} else {
return await promise
}
}, [])
}