我正在使用' react - native -remote- SVG‘在我的react原生expo应用程序中显示SVG图像。一切都在模拟器/设备上显示得很好,直到我在世博会上发布了应用程序,此时所有SVG图像都消失了。
示例代码:
import Image from 'react-native-remote-svg';
<Image
style={styling.imageStyle}
source={require('../res/images/sampleImage.svg')} />
发布于 2018-06-04 01:54:40
您必须预先加载它们,这样它们才能在生产版本中使用。
_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文件中。
https://stackoverflow.com/questions/49477063
复制相似问题