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

[Image] Getting intrinsic Image size in the onLoad event #2180

Closed
felixakiragreen opened this issue Jul 30, 2015 · 12 comments
Closed

[Image] Getting intrinsic Image size in the onLoad event #2180

felixakiragreen opened this issue Jul 30, 2015 · 12 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@felixakiragreen
Copy link
Contributor

I really needed to get the actual image size from a network image, so I could use it in styling my app.

@paramaggarwal showed me how to do it in this issue #494 and suggested I submit a PR for it.

I saw a comment somewhere by @vjeux that reworking Image was planned. Should I go ahead and do this? Or will it be unnecessary soon? Or am I a unique use-case?

@paramaggarwal
Copy link
Contributor

I think the reworking of image is what the change from separate RCTNetworkImage and RCTStaticImage to a single RCTImageView was. I guess it should be fine, and I think it is good information to have available to JS.

@MossP
Copy link

MossP commented Jul 31, 2015

+1 I have posted on stackoverflow about this .. tumbleweed. I hadn't noticed #494, @paramaggarwal, so I may look into this now, too.

@MossP
Copy link

MossP commented Jul 31, 2015

ps. you are not a unique use-case :)

@brentvatne brentvatne changed the title Getting intrinsic Image size in the onLoad event [Image] Getting intrinsic Image size in the onLoad event Jul 31, 2015
@nicklockwood
Copy link
Contributor

I can confirm we aren't planning on changing or extending the current implementation of RCTImageView in the next few weeks, if you'd like to propose any new functionality or file any PRs.

@paramaggarwal
Copy link
Contributor

That means you can go for it @DUBERT! Looking forward to the PR.

@felixakiragreen
Copy link
Contributor Author

Working on it, just kind of stuck right here: #2234

@felixakiragreen
Copy link
Contributor Author

Submitted a PR: #2364

@MossP
Copy link

MossP commented Oct 27, 2015

Shame that this never made it in. Manual patching is now more complex as Master has changed so much..

@nicklockwood
Copy link
Contributor

As I said in the PR feedback, we need to provide a way to preload images and get their dimensions, but doing it onscreen with <Image> like this is not really the right way :-/

@MossP
Copy link

MossP commented Oct 27, 2015

I understand, thanks @nicklockwood. Thanks also to @DUBERT for the solutions provided.

@mkonicek
Copy link
Contributor

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/image-getting-intrinsic-image-size-in-the-onload-event

ProductPains helps the community prioritize the most important issues thanks to its voting feature.
It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix.
We're a small team and rely on the community for bug fixes of issues that don't affect fb apps.

@JeroenNelen
Copy link

Is this currently being looked at or in? Are there any, currently working, solutions?
This is very annoying as we don't want to stretch loaded images because then they would become pixelated and the sizes can vary so we cannot set a specific height either.
Hopefully someone has some suggestions?

Kind regards,

@facebook facebook locked as resolved and limited conversation to collaborators Jul 22, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants