Javascript 如何在1次之后停止gif反应?

Javascript 如何在1次之后停止gif反应?,javascript,android,ios,reactjs,react-native,Javascript,Android,Ios,Reactjs,React Native,我有一个gif在反应,我想停止循环 我在我的视图中添加了一个图像,我给了这个图像我的gif的路径和它的作用,但是gif是无限循环的 有停止的想法吗 <Image source={require('./img/anim.gif')} /> 谢谢编辑 react native/Libraries/Image/RCTGIFImageDecoder.m CAKeyframeAnimation *animation = [CAKeyframeAnimation animatio

我有一个gif在反应,我想停止循环 我在我的视图中添加了一个图像,我给了这个图像我的gif的路径和它的作用,但是gif是无限循环的

有停止的想法吗

<Image
    source={require('./img/anim.gif')}
 />

谢谢

编辑 react native/Libraries/Image/RCTGIFImageDecoder.m

CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
    ...
animation.repeatCount = loopCount == 0 ? 0 : loopCount; // <-- fix for single play gif from joshbedo
animation.fillMode = @"forwards"; // <-- insert this line to prevent the image disappearing after animation
CAKeyframeAnimation*animation=[CAKeyframeAnimation animationWithKeyPath:@“contents”];
...
animation.repeatCount=loopCount==0?0:loopCount;// 编辑
react native/Libraries/Image/RCTGIFImageDecoder.m

CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
    ...
animation.repeatCount = loopCount == 0 ? 0 : loopCount; // <-- fix for single play gif from joshbedo
animation.fillMode = @"forwards"; // <-- insert this line to prevent the image disappearing after animation
CAKeyframeAnimation*animation=[CAKeyframeAnimation animationWithKeyPath:@“contents”];
...

animation.repeatCount=loopCount==0?0:loopCount;//我认为您还可以将gif设置为在其元标记中不重复,尽管在某些用例中这可能是不需要的。我认为您还可以将gif设置为在其元标记中不重复,尽管在某些用例中这可能是不需要的。