Expo/React Native Gif显示问题

7lrncoxx  于 6个月前  发布在  React
关注(0)|答案(1)|浏览(67)

我一直试图解决这个问题好几天了。我使用React Native (0.72),我已经尝试了Expo ImageImage Background等.但我不能让gif不显示“框架”或使其平滑。gif播放良好,如果我有它在桌面上。

<Image source={require('../assets/fly.gif')}
    style={styles.Gif} 
    contentFit="cover"
    transition={1000}/
 >

字符串


的数据

xzabzqsa

xzabzqsa1#

如果您使用的是Expo SDK 40或更高版本,则可能需要使用react-native-fast-image中的asset以获得最佳GIF性能。

import React from 'react';
import { View } from 'react-native';
import FastImage from 'react-native-fast-image';

const YourComponent = () => {
  const gifUri = require('./path/to/your/gif.gif');

  return (
    <View>
      {/* Use FastImage for displaying the GIF */}
      <FastImage
        source={gifUri}
        style={{ width: 200, height: 200 }}
        resizeMode={FastImage.resizeMode.contain}
      />
    </View>
  );
};

export default YourComponent;

字符串

相关问题