react-native-remote-svg icon indicating copy to clipboard operation
react-native-remote-svg copied to clipboard

iOS physical device shows no SVG images, Android works

Open thijssmudde opened this issue 7 years ago • 5 comments

The iOS simulator works exactly as intended. However, the SVG images are not shown when loaded on Expo on a physical iOS device. It works on Android however.

I have a project where this error is shown: https://exp.host/@fullhdpixel/groenteboer

Test it here: https://expo.io/appetize-simulator?url=https://expo.io/@fullhdpixel/groenteboer

Usage in App

<Product source={Images.peren}/>

Here is the styled component

import styled from 'styled-components'
import normalize from '../Helpers/normalizeSize'

export const Product = styled.Image`
  flex: 1;
  width: null;
  height: ${normalize(130)}px;
  width: 100%;
`

Images.js

peren: require('../Assets/Images/Products/peren.png'),

thijssmudde avatar Apr 01 '18 17:04 thijssmudde

👍 on this, I'm seeing the same issue.

@fullhdpixel did you find the cause of this?

rahulpatel avatar Jan 30 '19 11:01 rahulpatel

@rahulpatel I'm experiencing the same issue, I think it is because the image is imported from another file, here is an example:

// images.js
export default {
  MY_IMAGE: require('../path_to_svg_image'),
};

// MyComponent.js
import { MY_IMAGE } from '../config/images';
// ...
<Image source={MY_IMAGE} /> // this won't work
<Image source={require('../path_to_svg_image')} /> // this will work

ismnoiet avatar Jul 16 '19 11:07 ismnoiet

put <meta name="viewport" content="width=device-width, initial-scale=1"> between <head></head> in node_modules/react-native-remote-svg/SvgImage.js

vatichild avatar Jun 23 '21 11:06 vatichild

put <meta name="viewport" content="width=device-width, initial-scale=1"> between <head></head> in node_modules/react-native-remote-svg/SvgImage.js

@Vatia13 For running in local we can manually add in node modules. But how could we achieve this in staging environments and production ?

nrajiv84 avatar Oct 03 '22 22:10 nrajiv84

@vatichild Thank you very much for this fix.

Do you plan to make a pull request with this change?

melnikovkolya avatar Mar 27 '24 15:03 melnikovkolya