The problem
The Image component reloads on each rerender.
How to reproduce
https://codesandbox.io/s/happy-mountain-i2eol?file=/src/App.js
Steps to reproduce:
- Add the Image tag to your component
- Add the onLoad property to the Image tag
- set state in the onLoad property
Expected behavior
It would work similar to the img tag. Here is the same code sandbox with <Image swapped out for <img src= https://codesandbox.io/s/happy-bell-i4v5q?file=/src/App.js
Environment (include versions). Did this work in previous versions?
Please see code sandbox. It did not work differently in a previous verion that I am aware of.
Disclaimer: My expectations and use case might not align with react native web. However I am not sure how to successfully set state in onLoad without a duplicate render.
The problem
The Image component reloads on each rerender.
How to reproduce
https://codesandbox.io/s/happy-mountain-i2eol?file=/src/App.js
Steps to reproduce:
Expected behavior
It would work similar to the
imgtag. Here is the same code sandbox with<Imageswapped out for<img src=https://codesandbox.io/s/happy-bell-i4v5q?file=/src/App.jsEnvironment (include versions). Did this work in previous versions?
Please see code sandbox. It did not work differently in a previous verion that I am aware of.
Disclaimer: My expectations and use case might not align with react native web. However I am not sure how to successfully set state in onLoad without a duplicate render.