Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onLoad callback on Image is missing the source attribute #2268

Open
Sharcoux opened this issue Apr 1, 2022 · 2 comments
Open

onLoad callback on Image is missing the source attribute #2268

Sharcoux opened this issue Apr 1, 2022 · 2 comments
Labels
has: pr Subject of a pull request project:react-native-web Issue associated with react-native-web
Milestone

Comments

@Sharcoux
Copy link

Sharcoux commented Apr 1, 2022

The problem

Here is what the event looks like on onLoad:

image

But here is what the documentation tells us:

image

As you can see, the source attribute is missing.

How to reproduce

Simplified test case: here

Steps to reproduce:

  1. Create an Image
  2. Add an onLoad method
  3. Notice that the event.nativeEvent doesn't include the source attribute

Expected behavior

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.17.6
  • React (version): 17.0.2
  • Browser: 98.0.2 (64 bits)

Without this event, is there another way to detect the original width/height of the image?

@V1shvesh
Copy link

@Sharcoux seems like you might find the image height and width here:
image

Although it does deviate from the spec mentioned above.

@necolas necolas added the project:react-native-web Issue associated with react-native-web label Jul 2, 2022
@necolas necolas added this to the 0.19: Image milestone Jul 4, 2022
@necolas necolas added the has: pr Subject of a pull request label Apr 10, 2023
necolas pushed a commit that referenced this issue Apr 10, 2023
Extend ImageLoader functionality to be able to work with image sources
containing headers

We preserve the existing strategy that works with image.src for cases
where source is just an uri with no headers

When sources contain headers we make a fetch request and then render a
local url for the downloaded blob (URL.createObjectURL)

Fix #1019
Fix #2268
Close #2442
necolas pushed a commit that referenced this issue Apr 12, 2023
Extend ImageLoader functionality to be able to work with image sources
containing headers

We preserve the existing strategy that works with image.src for cases
where source is just an uri with no headers

When sources contain headers we make a fetch request and then render a
local url for the downloaded blob (URL.createObjectURL)

Fix #1019
Fix #2268
Close #2442
@GustavoBonfimS
Copy link

I faced the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: pr Subject of a pull request project:react-native-web Issue associated with react-native-web
Projects
None yet
Development

No branches or pull requests

4 participants