blurview on ios

This commit is contained in:
Samuel Newman
2024-11-12 23:03:25 +00:00
parent f89fb4c6cf
commit a8b95f9860
3 changed files with 86 additions and 52 deletions
@@ -0,0 +1,15 @@
import React from 'react'
import {BlurView} from 'expo-blur'
import {ViewStyleProp} from '#/alf'
export function PlatformBackground({
children,
style,
}: ViewStyleProp & {children: React.ReactNode}) {
return (
<BlurView tint="systemThickMaterialDark" intensity={75} style={style}>
{children}
</BlurView>
)
}
@@ -0,0 +1,14 @@
import React from 'react'
import {View} from 'react-native'
import {ViewStyleProp} from '#/alf'
/**
* Provides a view with a semi-transparent on Android/web, and a BlurView on iOS.
*/
export function PlatformBackground({
children,
style,
}: ViewStyleProp & {children: React.ReactNode}) {
return <View style={[{backgroundColor: '#000d'}, style]}>{children}</View>
}
+9 -4
View File
@@ -49,6 +49,7 @@ import {PlatformInfo} from '../../../../../modules/expo-bluesky-swiss-army'
import {ImageSource, Transform} from './@types' import {ImageSource, Transform} from './@types'
import ImageDefaultHeader from './components/ImageDefaultHeader' import ImageDefaultHeader from './components/ImageDefaultHeader'
import ImageItem from './components/ImageItem/ImageItem' import ImageItem from './components/ImageItem/ImageItem'
import {PlatformBackground} from './components/PlatformBackground'
type Rect = {x: number; y: number; width: number; height: number} type Rect = {x: number; y: number; width: number; height: number}
@@ -504,7 +505,8 @@ function LightboxFooter({
a.w_full, a.w_full,
a.absolute, a.absolute,
a.bottom_0, a.bottom_0,
{backgroundColor: '#000d'}, a.overflow_hidden,
{borderTopLeftRadius: 8, borderTopRightRadius: 8},
]} ]}
scrollEnabled={isAltExpanded} scrollEnabled={isAltExpanded}
onMomentumScrollBegin={() => { onMomentumScrollBegin={() => {
@@ -512,11 +514,13 @@ function LightboxFooter({
}} }}
onMomentumScrollEnd={() => { onMomentumScrollEnd={() => {
isMomentumScrolling.current = false isMomentumScrolling.current = false
}} }}>
contentContainerStyle={[a.py_md, a.px_2xl]}> <PlatformBackground style={[a.py_md, a.px_2xl]}>
<SafeAreaView edges={['bottom']}> <SafeAreaView edges={['bottom']}>
{altText ? ( {altText ? (
<View accessibilityRole="button" style={[isIOS ? a.pb_xl : a.pb_lg]}> <View
accessibilityRole="button"
style={[isIOS ? a.pb_xl : a.pb_lg]}>
<Text <Text
style={[t.atoms.text_contrast_high]} style={[t.atoms.text_contrast_high]}
numberOfLines={isAltExpanded ? undefined : 3} numberOfLines={isAltExpanded ? undefined : 3}
@@ -563,6 +567,7 @@ function LightboxFooter({
</View> </View>
</ThemeProvider> </ThemeProvider>
</SafeAreaView> </SafeAreaView>
</PlatformBackground>
</ScrollView> </ScrollView>
) )
} }