这是一个React Native应用程序。我正在实现显示图像的“封面”组件,一旦加载视频,图像就会淡出,而是播放视频。这是我的代码:
t2
我遇到的问题是,当从视频组件中调用esn_inter_intra_merge
时不会消失,图像消失了,正在播放视频。如果我这样做:
SELECT *
FROM esn_datafeed AS t1
LEFT JOIN esn_inter_intra_merge AS t2
ON t1.st_umts_df_relation_key = t2.st_umts_esn_inter_intra_relation_key
WHERE t2.st_umts_esn_inter_intra_relation_key IS NULL
动画按预期工作。我需要从视频export default function Cover() {
const [playVideo, setPlayVideo] = useState(false);
const [coverOpacityAnimation] = useState(new Animated.Value(1))
useEffect(() => {
if (!playVideo) return;
Animated.timing(coverOpacityAnimation, {
toValue: 0,
duration: 1000
}).start()
}, [playVideo])
return (
<View>
<Animated.View style={{opacity: coverOpacityAnimation}}>
<Image source={{uri: data.cover}} />
</Animated.View>
<Video
source={{uri: 'https://videostorage.net/public/video.mp4'}}
onReadyForDisplay={() => setPlayVideo(true)} />
</View>
);
}
触发它。钩子新手-请帮助:)