rm unnecessary effect
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React, {useCallback, useEffect, useId, useState} from 'react'
|
import React, {useCallback, useEffect, useId, useState} from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {Image} from 'expo-image'
|
import {ImageBackground} from 'expo-image'
|
||||||
import {PlayerError, VideoPlayerStatus} from 'expo-video'
|
import {PlayerError, VideoPlayerStatus} from 'expo-video'
|
||||||
import {AppBskyEmbedVideo} from '@atproto/api'
|
import {AppBskyEmbedVideo} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
@@ -8,6 +8,7 @@ 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'
|
||||||
@@ -117,12 +118,6 @@ function InnerWrapper({embed}: Props) {
|
|||||||
}
|
}
|
||||||
}, [player, isActive])
|
}, [player, isActive])
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!isActive && playerStatus !== 'loading') {
|
|
||||||
setPlayerStatus('loading')
|
|
||||||
}
|
|
||||||
}, [isActive, playerStatus])
|
|
||||||
|
|
||||||
const onChangeStatus = (isVisible: boolean) => {
|
const onChangeStatus = (isVisible: boolean) => {
|
||||||
if (isFullscreen) {
|
if (isFullscreen) {
|
||||||
return
|
return
|
||||||
@@ -153,47 +148,46 @@ function InnerWrapper({embed}: Props) {
|
|||||||
setIsFullscreen={setIsFullscreen}
|
setIsFullscreen={setIsFullscreen}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<View
|
{(isAndroid && showOverlay) || isIOS ? (
|
||||||
style={[
|
<ImageBackground
|
||||||
{
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
display: showOverlay ? 'flex' : 'none',
|
|
||||||
},
|
|
||||||
]}>
|
|
||||||
<Image
|
|
||||||
source={{uri: embed.thumbnail}}
|
source={{uri: embed.thumbnail}}
|
||||||
alt={embed.alt}
|
|
||||||
style={a.flex_1}
|
|
||||||
contentFit="cover"
|
contentFit="cover"
|
||||||
|
alt={embed.alt}
|
||||||
accessibilityIgnoresInvertColors
|
accessibilityIgnoresInvertColors
|
||||||
/>
|
style={[
|
||||||
<Button
|
{
|
||||||
style={[a.absolute, a.inset_0]}
|
position: 'absolute',
|
||||||
onPress={() => {
|
top: 0,
|
||||||
setActiveSource(embed.playlist, viewId)
|
bottom: 0,
|
||||||
}}
|
left: 0,
|
||||||
label={_(msg`Play video`)}
|
right: 0,
|
||||||
color="secondary">
|
display: showOverlay ? 'flex' : 'none',
|
||||||
{isLoading ? (
|
},
|
||||||
<View
|
]}>
|
||||||
style={[
|
<Button
|
||||||
a.rounded_full,
|
style={[a.flex_1, a.align_center, a.justify_center]}
|
||||||
a.p_xs,
|
onPress={() => {
|
||||||
a.absolute,
|
setActiveSource(embed.playlist, viewId)
|
||||||
{top: 'auto', left: 'auto'},
|
}}
|
||||||
{backgroundColor: 'rgba(0,0,0,0.5)'},
|
label={_(msg`Play video`)}
|
||||||
]}>
|
color="secondary">
|
||||||
<Loader size="2xl" style={{color: 'white'}} />
|
{isLoading ? (
|
||||||
</View>
|
<View
|
||||||
) : (
|
style={[
|
||||||
<PlayButtonIcon />
|
a.rounded_full,
|
||||||
)}
|
a.p_xs,
|
||||||
</Button>
|
a.absolute,
|
||||||
</View>
|
{top: 'auto', left: 'auto'},
|
||||||
|
{backgroundColor: 'rgba(0,0,0,0.5)'},
|
||||||
|
]}>
|
||||||
|
<Loader size="2xl" style={{color: 'white'}} />
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<PlayButtonIcon />
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</ImageBackground>
|
||||||
|
) : null}
|
||||||
</VisibilityView>
|
</VisibilityView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user