世博会应用发布后SVG图像消失

时间:2018-03-25 14:42:21

标签: react-native svg expo

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

示例代码:

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

1 个答案:

答案 0 :(得分:1)

您必须预加载它们,因此它们将在生产版本中可用。

 _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文件中。