only show video once

This commit is contained in:
2026-02-12 13:44:48 +01:00
parent 8e2643b856
commit 6ccac084dc
+7 -1
View File
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { View } from 'react-native' import { View } from 'react-native'
import { useIsFocused } from '@react-navigation/native'
import { background } from '../../assets' import { background } from '../../assets'
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo' import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
import GradientButton from '../../components/GradientButton' import GradientButton from '../../components/GradientButton'
@@ -13,6 +14,7 @@ import { isWeb } from '../../hooks/useLayoutType'
const Compose = () => { const Compose = () => {
const { videos } = useUserData() const { videos } = useUserData()
const isFocused = useIsFocused()
const [videoUrl, setVideoUrl] = useState(null) const [videoUrl, setVideoUrl] = useState(null)
@@ -40,7 +42,11 @@ const Compose = () => {
/> />
</View> </View>
</View> </View>
<FullscreenIntroVideo visible={!!videoUrl} url={videoUrl} onClose={() => setVideoUrl(null)} /> <FullscreenIntroVideo
visible={isFocused && !!videoUrl}
url={videoUrl}
onClose={() => setVideoUrl(null)}
/>
</Page> </Page>
) )
} }