Expo 应用程序发布后 SVG 图像消失

2024-01-08

我正在使用“react-native-remote-svg”在我的 React Native Expo 应用程序中显示 SVG 图像。一切都在模拟器/设备上显示得很好,直到我在 Expo 中发布应用程序,此时所有 SVG 图像都消失了。

示例代码:

import Image from 'react-native-remote-svg';
<Image
   style={styling.imageStyle}
   source={require('../res/images/sampleImage.svg')} />

您必须预加载它们,以便它们在生产版本中可用。

_loadResourcesAsync = async () => {
  return Promise.all([
    Asset.loadAsync([
      require('./assets/svg/some.svg')
    ]),
    Font.loadAsync({
      // This is the font that we are using for our tab bar
      ...Ionicons.font,
      // We include SpaceMono because we use it in HomeScreen.js. Feel free
      // to remove this if you are not using it in your app
      'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
    }),
  ]);
};

在您的 expo 项目的 App.js 文件中。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Expo 应用程序发布后 SVG 图像消失 的相关文章

随机推荐