Skip to content

[web] withUniwind breaks expo-image via dataSet prop clobbering #625

Description

@bradleyayers

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

  1. Render an <Image source={…} transition={200}> from expo-image (the transition prop is required to reproduce this).
  2. 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 〰

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions