Skip to content

Instantly share code, notes, and snippets.

@makirby
Created September 7, 2018 11:31
Show Gist options
  • Save makirby/6f7a0b6ef2e8865751206b2b69e1abdc to your computer and use it in GitHub Desktop.
Save makirby/6f7a0b6ef2e8865751206b2b69e1abdc to your computer and use it in GitHub Desktop.
patch-package
--- a/node_modules/react-native/React/Base/RCTUtils.m
+++ b/node_modules/react-native/React/Base/RCTUtils.m
@@ -714,7 +714,14 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
} else {
fileData = [NSData dataWithContentsOfURL:imageURL];
}
- image = [UIImage imageWithData:fileData];
+ // Fix Codepush
+ CGFloat scale = 1.0;
+ if ([[imageURL absoluteString] hasSuffix: @"@3x.png"]) {
+ scale = 3.0;
+ } else if ([[imageURL absoluteString] hasSuffix: @"@2x.png"]) {
+ scale = 2.0;
+ }
+ image = [UIImage imageWithData:fileData scale: scale];
}
if (!image && !bundle) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment