use color scheme in in-app browser (#2580)
parent
010e94a6a9
commit
6569f8a870
|
@ -4,6 +4,7 @@ import {Linking} from 'react-native'
|
||||||
import * as WebBrowser from 'expo-web-browser'
|
import * as WebBrowser from 'expo-web-browser'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {useModalControls} from '../modals'
|
import {useModalControls} from '../modals'
|
||||||
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
|
|
||||||
type StateContext = persisted.Schema['useInAppBrowser']
|
type StateContext = persisted.Schema['useInAppBrowser']
|
||||||
type SetContext = (v: persisted.Schema['useInAppBrowser']) => void
|
type SetContext = (v: persisted.Schema['useInAppBrowser']) => void
|
||||||
|
@ -52,6 +53,7 @@ export function useSetInAppBrowser() {
|
||||||
export function useOpenLink() {
|
export function useOpenLink() {
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const enabled = useInAppBrowser()
|
const enabled = useInAppBrowser()
|
||||||
|
const pal = usePalette('default')
|
||||||
|
|
||||||
const openLink = React.useCallback(
|
const openLink = React.useCallback(
|
||||||
(url: string, override?: boolean) => {
|
(url: string, override?: boolean) => {
|
||||||
|
@ -66,13 +68,14 @@ export function useOpenLink() {
|
||||||
WebBrowser.openBrowserAsync(url, {
|
WebBrowser.openBrowserAsync(url, {
|
||||||
presentationStyle:
|
presentationStyle:
|
||||||
WebBrowser.WebBrowserPresentationStyle.FULL_SCREEN,
|
WebBrowser.WebBrowserPresentationStyle.FULL_SCREEN,
|
||||||
|
toolbarColor: pal.colors.backgroundLight,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Linking.openURL(url)
|
Linking.openURL(url)
|
||||||
},
|
},
|
||||||
[enabled, openModal],
|
[enabled, openModal, pal.colors.backgroundLight],
|
||||||
)
|
)
|
||||||
|
|
||||||
return openLink
|
return openLink
|
||||||
|
|
Loading…
Reference in New Issue