question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: iOS images loaded from filesystem don't respect scaling factor in filename

See original GitHub issue

Environment

React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel® Core™ i7-8559U CPU @ 2.70GHz Memory: 206.29 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.9.0 - /src/homebrew/bin/node Yarn: 1.9.4 - /src/homebrew/bin/yarn npm: 6.2.0 - /src/homebrew/bin/npm SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 Android SDK: API Levels: 28 Build Tools: 28.0.2 IDEs: Android Studio: 3.1 AI-173.4907809 Xcode: 10.0/10A255 - /usr/bin/xcodebuild npmPackages: react: 16.6.1 => 16.6.1 react-native: 0.57.5 => 0.57.5

Description

Image assets loaded from the filesystem don’t respect iOS’s image scaling naming convention.

This appears to be a regression of functionality introduced by 998197f444aca06cde0d5258469b3d314f8ea8b9 where [UIImage imageWithContentsOfFile:filePath]; was replaced by [UIImage imageWithData:fileData];, but that leaves UIKit unable to inspect the filePath for the presence of @3x filename suffixes.

Reverting that change locally fixes the issue.

Where this really comes into play is in projects using CodePush where the image assets are loaded from the filesystem (e.g., file:///.../Library/Application%20Support/CodePush/path/to/Image@3x.png) vs. the bundle included with the application at build time (e.g., file:///var/containers/Bundle/Application/.../path/to/Image@3x.png) where the filename-based constructor [UIImage imageNamed:imageName]; is used.

Reproducible Demo

CodePush bugs contain references to sample repros: https://github.com/Microsoft/react-native-code-push/issues/1222 https://github.com/Microsoft/react-native-code-push/issues/1276

Let me know if you need any help setting up a repro… although at a minimum if the desired functionality is to always respect iOS’s image scaling filename convention then I feel it should be fairly safe to revert (a portion of) the original change.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:22
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
tbergquist-godaddycommented, Jan 18, 2019

We are also having this issue.

This is how it looks in development: image

And this is how it looks with code-push image

5reactions
MichielDeMeycommented, Dec 26, 2018

This is a legit issue, we’re currently unable to add CodePush support to our app due to this limitation. 😔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari Technology Preview Release Notes - Apple Developer
Added width and height content attributes to <model> (257294@main); Changed to not apply aspect ratio scaling to gradient background images that don't have ......
Read more >
Images Uploaded Blurry and say scale in file name now
I went to preview a post and saw that my featured image was completely blurry today. This has never happened to me before....
Read more >
CellProfiler: Table of contents - Amazon AWS
CellProfiler is a versatile, open-source software tool for quantifying data from biological images, particularly in high-throughput experiments.
Read more >
Untitled
Exclusively use the `truetype' font driver for loading the font contained in the `sfnts' array. - Fixes CVE-2014-9663 - Fix order of validity...
Read more >
Export - Jupyter Notebooks Gallery
In this section, you can learn how to save images, layout and network. ... of the specified type to the specified file, at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found