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

feat: allow custom image scales on iOS #10212

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

edusperoni
Copy link
Contributor

PR Checklist

What is the current behavior?

Images are always loaded with scale 1.0 (if they are files/resources then they're loaded with the appropriate scale when @2x.png is provided, for example)

What is the new behavior?

Allows you to set a hardcoded scale for the image.

@nx-cloud
Copy link

nx-cloud bot commented Feb 14, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit af106de. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@cla-bot cla-bot bot added the cla: yes label Feb 14, 2023
@edusperoni
Copy link
Contributor Author

This might be too much of a burden to support in the future (especially if we decide to support orientation as well).

This is a viable alternative that's around 0.02ms slower and doesn't require any code to support:

function setImageSourceScale(source: ImageSource, scale: number) {
  const image = source.ios;
  return new ImageSource(UIImage.imageWithCGImageScaleOrientation(image.CGImage, scale, image.imageOrientation));
}

@NathanWalker NathanWalker added this to the 8.5 milestone Feb 16, 2023
@NathanWalker NathanWalker modified the milestones: 8.5, 8.6 Mar 23, 2023
@NathanWalker NathanWalker modified the milestones: 8.6, 9.0 Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants