software-mansion / react-native-svg

SVG library for React Native, React Native Web, and plain React web projects.
MIT License
7.5k stars 1.13k forks source link

ForeignObject working wrong (react image not loading, view transform not work) #1906

Open ANUGLYPLUGIN opened 2 years ago

ANUGLYPLUGIN commented 2 years ago

Bug

ForeignObject combine with react component wrong, many parts do not work.

Unexpected behavior

Image not show in ForeignObject, view transform not work

Version

Steps To Reproduce

Use Readme.md code

<ForeignObject x={50} y={0} width={100} height={100}>
  <View style={{ width: 200, height: 400, transform: [] }}>
    <Image
      style={{ width: 200, height: 200 }}
      source={{
        uri: 'https://picsum.photos/200/200',
      }}
    />
  </View>
</ForeignObject>
felixchan commented 1 year ago

I have the same problem. Image not appearing inside ForeignObject.

ANUGLYPLUGIN commented 1 year ago

Excuse me @WoLewicki, Can you help us check that problem? I debug here https://github.com/software-mansion/react-native-svg/blob/2c59100e24853cbdd208f745ea64f366f7e00e6f/apple/Elements/RNSVGForeignObject.mm#L133 the nodes and its subviews can not show.

ANUGLYPLUGIN commented 1 year ago

The md example is shown but if you give width to Svg it will hide as well.

WoLewicki commented 1 year ago

I tested the example and it worked well with width added. What I spotted is that on iOS, the images did not load on the first render, probably due being fetched from remote, and after it is done, the layer is already drawn as in the code you pointed, so the view is not updated. Can you provide a simple snack with what is not working correctly in your case?

ANUGLYPLUGIN commented 1 year ago

@WoLewicki

dodicandra commented 1 year ago

any updates?