What happened?
I have an <Image> that I re-render and change the source. The image works properly the first few times I change source, but then it stops updating correctly and it just gets stuck on one image and none of the onLoad* handlers fire correctly.
I've narrowed it down to the way withUniwind works and always passes through a dataSet prop even if it's empty (see
|
dataSet={generateDataSet(props)} |
).
Then look at the web implementation of ExpoImage https://github.com/expo/expo/blob/42c88e4f0e92eba794f1e454ccd50aa1f0a72adc/packages/expo-image/src/ExpoImage.web.tsx#L174 and you see that it needs the magic expoimage: true value set, but a couple of lines down it can be clobbered by {...props}.
I'd argue this is also a bug in expo-image, in that it doesn't merge together dataSet, however Uniwind could also avoid this by not passing through dataSet unless it's necessary.
Steps to Reproduce
- Render an
<Image source={…} transition={200}> from expo-image (the transition prop is required to reproduce this).
- Re-render it with a button or some other state to switch the
source prop to another value.
Snack or Repository Link
https://github.com/bradleyayers/uniwind-withuniwind-warning/tree/expo-image-source-dataset
Uniwind version
1.10.0
React Native Version
0.86.0
Platforms
Web
Expo
Yes
Additional information 〰
What happened?
I have an
<Image>that I re-render and change thesource. The image works properly the first few times I changesource, but then it stops updating correctly and it just gets stuck on one image and none of theonLoad*handlers fire correctly.I've narrowed it down to the way
withUniwindworks and always passes through adataSetprop even if it's empty (seeuniwind/packages/uniwind/src/hoc/withUniwind.tsx
Line 140 in 4614d75
Then look at the web implementation of ExpoImage https://github.com/expo/expo/blob/42c88e4f0e92eba794f1e454ccd50aa1f0a72adc/packages/expo-image/src/ExpoImage.web.tsx#L174 and you see that it needs the magic
expoimage: truevalue set, but a couple of lines down it can be clobbered by{...props}.I'd argue this is also a bug in expo-image, in that it doesn't merge together
dataSet, however Uniwind could also avoid this by not passing throughdataSetunless it's necessary.Steps to Reproduce
<Image source={…} transition={200}>from expo-image (thetransitionprop is required to reproduce this).sourceprop to another value.Snack or Repository Link
https://github.com/bradleyayers/uniwind-withuniwind-warning/tree/expo-image-source-dataset
Uniwind version
1.10.0
React Native Version
0.86.0
Platforms
Web
Expo
Yes
Additional information 〰