Lock scroll on web, fix backdrop
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
export function LockScroll() {
|
||||||
|
return null
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import {RemoveScrollBar} from 'react-remove-scroll-bar'
|
||||||
|
|
||||||
|
export const LockScroll = RemoveScrollBar
|
||||||
@@ -1,15 +1,20 @@
|
|||||||
import {createContext, useMemo, useContext, useState, ReactNode} from 'react'
|
import {
|
||||||
import {View, ScrollView, useWindowDimensions} from 'react-native'
|
createContext,
|
||||||
// import {FocusScope} from 'radix-ui/internal'
|
type ReactNode,
|
||||||
// import {RemoveScrollBar} from 'react-remove-scroll-bar'
|
useContext,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
|
import {ScrollView, useWindowDimensions, View} from 'react-native'
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||||
import {LinearGradient} from 'expo-linear-gradient'
|
import {LinearGradient} from 'expo-linear-gradient'
|
||||||
|
|
||||||
import {FocusScope} from '#/components/FocusScope'
|
import {isAndroid, isNative} from '#/platform/detection'
|
||||||
import {isNative, isAndroid} from '#/platform/detection'
|
|
||||||
import {atoms as a, useTheme, useBreakpoints, web, flatten} from '#/alf'
|
|
||||||
import {transparentifyColor} from '#/alf/util/colorGeneration'
|
|
||||||
import {useA11y} from '#/state/a11y'
|
import {useA11y} from '#/state/a11y'
|
||||||
|
import {atoms as a, flatten, useBreakpoints, useTheme, web} from '#/alf'
|
||||||
|
import {transparentifyColor} from '#/alf/util/colorGeneration'
|
||||||
|
import {FocusScope} from '#/components/FocusScope'
|
||||||
|
import {LockScroll} from '#/components/LockScroll'
|
||||||
|
|
||||||
const GUTTER = 24
|
const GUTTER = 24
|
||||||
|
|
||||||
@@ -50,8 +55,22 @@ export function AnnouncementDialog({
|
|||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.fixed, a.inset_0, {zIndex: 9999}]}>
|
<>
|
||||||
|
<LockScroll />
|
||||||
|
|
||||||
<View style={[a.fixed, a.inset_0, !reduceMotionEnabled && a.fade_in]}>
|
<View style={[a.fixed, a.inset_0, !reduceMotionEnabled && a.fade_in]}>
|
||||||
|
{gtPhone ? (
|
||||||
|
<View style={[a.absolute, a.inset_0, {opacity: 0.8}]}>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
a.fixed,
|
||||||
|
a.inset_0,
|
||||||
|
{backgroundColor: t.palette.black},
|
||||||
|
!reduceMotionEnabled && a.fade_in,
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={[
|
colors={[
|
||||||
transparentifyColor(t.atoms.bg.backgroundColor, 0),
|
transparentifyColor(t.atoms.bg.backgroundColor, 0),
|
||||||
@@ -62,10 +81,9 @@ export function AnnouncementDialog({
|
|||||||
end={[0.5, 1]}
|
end={[0.5, 1]}
|
||||||
style={[a.absolute, a.inset_0]}
|
style={[a.absolute, a.inset_0]}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* <RemoveScrollBar /> */}
|
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[a.fixed, a.inset_0, a.z_10]}
|
style={[a.fixed, a.inset_0, a.z_10]}
|
||||||
@@ -143,6 +161,6 @@ export function AnnouncementDialog({
|
|||||||
</FocusScope>
|
</FocusScope>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import {View} from 'react-native'
|
||||||
|
|
||||||
import {AnnouncementDialogOuter} from '#/components/dialogs/BlockingAnnouncements/AnnouncementDialog'
|
import {AnnouncementDialogOuter} from '#/components/dialogs/BlockingAnnouncements/AnnouncementDialog'
|
||||||
import * as PolicyUpdate20250801 from '#/components/dialogs/BlockingAnnouncements/PolicyUpdate20250801'
|
import * as PolicyUpdate20250801 from '#/components/dialogs/BlockingAnnouncements/PolicyUpdate20250801'
|
||||||
import {createPortalGroup} from '#/components/Portal'
|
import {createPortalGroup} from '#/components/Portal'
|
||||||
@@ -5,9 +7,16 @@ import {createPortalGroup} from '#/components/Portal'
|
|||||||
const portalGroup = createPortalGroup()
|
const portalGroup = createPortalGroup()
|
||||||
|
|
||||||
export const Provider = portalGroup.Provider
|
export const Provider = portalGroup.Provider
|
||||||
export const Outlet = portalGroup.Outlet
|
|
||||||
export const Portal = portalGroup.Portal
|
export const Portal = portalGroup.Portal
|
||||||
|
|
||||||
|
export function Outlet() {
|
||||||
|
return (
|
||||||
|
<View style={{zIndex: 9999}}>
|
||||||
|
<portalGroup.Outlet />
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export function BlockingAnnouncements() {
|
export function BlockingAnnouncements() {
|
||||||
const policyUpdate20250801 = PolicyUpdate20250801.useLocalState()
|
const policyUpdate20250801 = PolicyUpdate20250801.useLocalState()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user