Images should render properly as it is in dev version debug mode
Images with resizeMode "center" gets resizeMode "cover". I am mentioning "cover" because it matches with it in dev mode.
### SCREENSHOTS
After CodePush to Production App - 1 Improper images
After CodePush to Production App - 1 Some proper images - Images representing Views, Comments, Attachments are looking good.
The App uses this tabbar component in React Navigation
For the topbar it uses StackNavigator.
I notice this for resizeMode: "stretch" too. We are using stretch together with capInsets for some shadow assets (on semi transparent views) and it makes the shadow look completely wrong.
Aha, actually I see now that resizeMode: "stretch" is respected but it seems like the capInsets are just gone (which makes the shadow look wrong). Maybe a separate issue.
+1
Hey there!
We haven't forgotten about this issue. We have been doing some internal changes on the way we're executing github support. Are you still having this problem?
Hello, the case I mentioned above: yes!
On Mon, 26 Mar 2018 at 23:02, Zakeel M. notifications@github.com wrote:
Hey there!
We haven't forgotten about this issue. We have been doing some internal
changes on the way we're executing github support. Are you still having
this problem?—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/react-native-code-push/issues/1222#issuecomment-376310545,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAK22O5xkrsM_c4RwbZgzo4B7BIb_8qWks5tiVdjgaJpZM4SYeGg
.
Hi guys,
Unfortunately I can't reproduce you issue.
There is my App.js:
import React, { Component } from 'react';
import { StyleSheet, Text, View, TouchableOpacity, Image } from 'react-native';
import codePush from "react-native-code-push";
class App extends React.Component {
render() {
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Image
style={{width: 100, height: 100, margin: 20}}
source={require('./1.png')}
resizeMode='cover'
tintColor='#ff00ff'
/>
<Image
style={{width: 100, height: 100, margin: 20}}
source={require('./1.png')}
resizeMode='center'
tintColor='#ff00ff'
/>
<Image
style={{width: 100, height: 100, margin: 20}}
source={require('./1.png')}
resizeMode='stretch'
tintColor='#ff00ff'
capInsets={{left: 15, right: 15, bottom: 15, top: 15}}
/>
<TouchableOpacity
style = {{height: 70, width: 200, backgroundColor: 'green'}}
onPress={() => {
codePush.sync({
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE
});
}}>
<Text>Current version: 15</Text>
</TouchableOpacity>
</View>
)
}
}
let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
export default App = codePush(codePushOptions)(App);
After codepush release was installed all looks the same as in a binary version:

Would be great if you can create little project which I can use to reproduce
Thanks!
@iTOYS Thanks for the reply. In the case I described above (using a drop shadow image), we use absolute position and unset the width/height like this:
shadow: {
position: "absolute",
top: -18,
left: -20,
bottom: -22,
right: -20,
width: undefined,
height: undefined,
},
with capInsets:
{
top: 22,
left: 24,
bottom: 26,
right: 24,
}
This is probably relevant to the issue, especially unsetting width/height, I should have mentioned it before.
Sorry guys, I doesn't see difference between binary version and codepush.
Example project would be helpful!
Sorry, was busy in other projects. I am still facing this issue. @iTOYS It's not possible for me to create a example project for some days. The only difference I see in Code push code is, I am not doing it manually, its done by Default option which is OnAppResume I think. I have updated the screenshots and text also, feel free to ask questions!
Hi @Ashwin-Mothilal
I don't have access to new images.
CodePush options which i use don't have any affects to styles.
I'm waiting project from you :)
Thanks!
I have changed the permissions for the images, you can check it now. Just have a look at it. I will try to give project after this week, working on other production issues.
Noticing this as well. Changing to resizeMode={'contain'} seems to fix it. Most of these were absolutely positioned images. Maybe some data stripped from assets in the bundling/distribution process?
CodePush and plugins doesn't change your code and assets.
Could you please download your bundle and compare props values?
https://codepush.azurewebsites.net/updateCheck?deploymentKey=[your-key]&appVersion=[app-version]
Closing this issue for now! I recommend you to wrap all your props values with {}
Thanks!
Hi, I am attaching the sample project for you here
Please find the image after code push Update

What if we are not using it as props but using it within the Image style object? Same problem? Also would it not make sense to have the code-push build mimic the behaviour of a normal production build? Production builds work and look just fine with no errors whatsoever.
Same here. I have two separate issueses.
First is a background image for a chat. It had transparency (by mistake) and for some reason it was resized incorrectly. It was zoomed and very low res. iOS had this bug, but android works well.
Second case is a simple png images with capInsets. It looks like it just ignores cap insets at all.
UPD:
I actually tried to dig deeper to investigate problem with capInsets and found that in binary build image is not resized before applying capInsets (as it should be), but in codepush version RCTImageView resizes an image for some reason.
UPD2:
Ah, i found the source of issue. Image was loaded without respect to screen dencity (x3 on iPhone X) when is loaded from codepush. Loading from local bundle works just fine. Still trying to figure out work-around...
Ok, i figured out the root cause of the issue. When loading images from CodePush bundle it doesn't respect scale factor of the resource. It works well for built-in resources since UIImage can load with right scale factor automatically.
Unfortunately, the only (and dirty) solution is to patch react-native implementation.
In react-native/React/Base/RTCUtils.m patch RCTImageFromLocalAssetURL:
image = [UIImage imageWithData:fileData];
with
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];
This will work only for png files.
@itoys should we open this back up?
For sure it should be opened back. Also after digging around image loading it turns out that there are no image caching at all for built-in images on iOS. For example, if app will show series of messages with bubble decorations then build with codepush will load each image again and again. That's really creepy for performance.
@ex3ndr you're a damn hero
@iTOYS or anyone from Microsoft can you open this back up please or let us know how we can deal with it? Editing React Native core files is not an option.
Hi all,
Sure, I'll reopen it. Thanks for reporting!
It requires more time for investigate. Sorry for this delay.
@stueynet for now i am patching the RN package using the code from @ex3ndr, for me this is a good solution as all our images follow that exact convention. Though it may not work for you.
https://gist.github.com/makirby/6f7a0b6ef2e8865751206b2b69e1abdc
@ex3ndr's solution works for me, thank you for digging into it. But I think it's pretty hacky
Hello,
I just noticed the same problem trying to update my app with CodePush...
Is this a react-native related bug ? if so, is there a pull request to change RCTImageFromLocalAssetURL ?
@wynch yes, it's RN issue. CodePush does nothing with your js/assets. It just calls RN cli under the hood and pushes generated bundle to CodePush server from where your customers can download it. The main difference between downloaded bundle and binary bundle is location. We saw several places in RN code where there are conditions checking whether bundle/asset is located in app or in file system. We don't know if there is a PR with fixes in RN repository.
Hi,
I just bumped into this same problem today.
I have a background image with "resizeMode: 'repeat'". After updating the sentence in the middle of the screen using codepush, the image resizeMode or size changes (iPhone 6):

This project is available here: https://github.com/Fsarmento/codepushImageRepeate
Hi @Fsarmento! thanks for demo app! I've reproduced the issue. Please try to apply workaround suggested by @ex3ndr above. It works for me.
Modifying React Native's code is not a solution for any project using continuous integration so this issue prevents Code Push from being integrated in medium to large size apps.
I ran into this -- as far as I can tell it's a regression introduced in RN itself and I filed https://github.com/facebook/react-native/issues/22383
Most of the images in our application are messed up and it's blocking our use of CodePush for our application :(
Hi @ascherkus!
You did a really great job finding this particular commit! 👍
I wish we'd figured it out sooner and I hope it will be fixed soon.
Same problem here... I solved forcing the image to be with resizeMode stretch 😞
Hello @geof90 @lostintangent @max-mironov
I'm facing the same issue, removing resizeMode: "center" fixed the problem, can you have a look at this please ?
It's really important I guess for many company that relies heavily on Codepush…
Best regards guys
Hey guys, a fix has been merged into master in the React Native project.
(cfr. https://github.com/facebook/react-native/issues/22383 & https://github.com/facebook/react-native/pull/23446)
You can create a patch file from the following diff: https://patch-diff.githubusercontent.com/raw/facebook/react-native/pull/23446.diff
Marvelous ! I made a workaround, i'll wait react native to update :) THanks
Hi all,
I see that This issue have been fixed in react-native. https://github.com/facebook/react-native/issues/22383
So, I'm going to close this issue for now. Please feel free to reopen it if you have any questions.
Thanks,
Alexander
@ScreamZ What workaround did you do?
Not using center mode, i was not specially requiring it for my use case.
updating to RN 0.59.1 worked for me
Most helpful comment
Ok, i figured out the root cause of the issue. When loading images from CodePush bundle it doesn't respect scale factor of the resource. It works well for built-in resources since UIImage can load with right scale factor automatically.
Unfortunately, the only (and dirty) solution is to patch react-native implementation.
In react-native/React/Base/RTCUtils.m patch
RCTImageFromLocalAssetURL:with
This will work only for png files.