fix android

This commit is contained in:
Hailey
2024-09-05 19:36:09 -07:00
parent 490f552c57
commit 494d0699e5
+8 -9
View File
@@ -8,7 +8,6 @@ import {useLingui} from '@lingui/react'
import {clamp} from '#/lib/numbers' import {clamp} from '#/lib/numbers'
import {useGate} from '#/lib/statsig/statsig' import {useGate} from '#/lib/statsig/statsig'
import {isAndroid, isIOS} from 'platform/detection'
import {VideoEmbedInnerNative} from '#/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative' import {VideoEmbedInnerNative} from '#/view/com/util/post-embeds/VideoEmbedInner/VideoEmbedInnerNative'
import {atoms as a} from '#/alf' import {atoms as a} from '#/alf'
import {Button} from '#/components/Button' import {Button} from '#/components/Button'
@@ -148,22 +147,23 @@ function InnerWrapper({embed}: Props) {
setIsFullscreen={setIsFullscreen} setIsFullscreen={setIsFullscreen}
/> />
) : null} ) : null}
{(isAndroid && showOverlay) || isIOS ? (
<ImageBackground <ImageBackground
source={{uri: embed.thumbnail}} source={{uri: embed.thumbnail}}
contentFit="cover"
alt={embed.alt}
accessibilityIgnoresInvertColors accessibilityIgnoresInvertColors
style={[ style={[
{ {
position: 'absolute', position: 'absolute',
top: 0, top: 0,
bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
bottom: 0,
backgroundColor: 'transparent', // If you don't add `backgroundColor` to the styles here,
// the play button won't show up on the first render on android 🥴😮‍💨
display: showOverlay ? 'flex' : 'none', display: showOverlay ? 'flex' : 'none',
}, },
]}> ]}
cachePolicy="memory-disk" // Preferring memory cache helps to avoid flicker when re-displaying on android
>
<Button <Button
style={[a.flex_1, a.align_center, a.justify_center]} style={[a.flex_1, a.align_center, a.justify_center]}
onPress={() => { onPress={() => {
@@ -176,8 +176,8 @@ function InnerWrapper({embed}: Props) {
style={[ style={[
a.rounded_full, a.rounded_full,
a.p_xs, a.p_xs,
a.absolute, a.align_center,
{top: 'auto', left: 'auto'}, a.justify_center,
{backgroundColor: 'rgba(0,0,0,0.5)'}, {backgroundColor: 'rgba(0,0,0,0.5)'},
]}> ]}>
<Loader size="2xl" style={{color: 'white'}} /> <Loader size="2xl" style={{color: 'white'}} />
@@ -187,7 +187,6 @@ function InnerWrapper({embed}: Props) {
)} )}
</Button> </Button>
</ImageBackground> </ImageBackground>
) : null}
</VisibilityView> </VisibilityView>
) )
} }