Reputation: 51
I am using 'react-native-remote-svg' to display SVG images in my react native expo app. Everything displays nicely on simulators/devices until I publish the app in Expo, at this point all SVG images disappear.
Example code:
import Image from 'react-native-remote-svg';
<Image
style={styling.imageStyle}
source={require('../res/images/sampleImage.svg')} />
Upvotes: 2
Views: 1554
Reputation: 31
You have to preload them, so they will be available in production build.
_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'),
}),
]);
};
In your App.js file of expo project.
Upvotes: 2