react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

Images not rendering properly on ios after code-push with resizeMode center

Open Ashwin-Mothilal opened this issue 8 years ago • 41 comments

Steps to Reproduce

  1. React Native Image Component local image which matches resizeMode center
  2. Install the app from Xcode Production version
  3. Change the tintColor of the image or change text if you have
  4. Release using "code-push release-react ios "

Expected Behavior

Images should render properly as it is in dev version debug mode

Actual Behavior

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.

Expected / Debug Build

Environment

  • react-native-code-push version: 5.2.1
  • react-native version: 0.52.0
  • iOS/Android/Windows version: iOS version 11.2.6
  • Does this reproduce on a debug build or release build? Release

###Notes The App uses this tabbar component in React Navigation For the topbar it uses StackNavigator.

Ashwin-Mothilal avatar Mar 01 '18 15:03 Ashwin-Mothilal

@ex3ndr you're a damn hero

makirby avatar Sep 06 '18 16:09 makirby

@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.

stueynet avatar Sep 06 '18 17:09 stueynet

Hi all,

Sure, I'll reopen it. Thanks for reporting! It requires more time for investigate. Sorry for this delay.

alexandergoncharov-zz avatar Sep 07 '18 10:09 alexandergoncharov-zz

@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

makirby avatar Sep 07 '18 11:09 makirby

@ex3ndr's solution works for me, thank you for digging into it. But I think it's pretty hacky

bthuan avatar Sep 11 '18 20:09 bthuan

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 avatar Sep 25 '18 10:09 wynch

@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.

NickToropov avatar Sep 26 '18 13:09 NickToropov

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):

screen shot 2018-10-03 at 12 16 03

This project is available here: https://github.com/Fsarmento/codepushImageRepeate

Fsarmento avatar Oct 03 '18 11:10 Fsarmento

Hi @Fsarmento! thanks for demo app! I've reproduced the issue. Please try to apply workaround suggested by @ex3ndr above. It works for me.

NickToropov avatar Oct 04 '18 14:10 NickToropov

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.

emilioicai avatar Nov 09 '18 10:11 emilioicai

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 :(

ascherkus avatar Nov 22 '18 16:11 ascherkus

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.

yuri-kulikov avatar Nov 22 '18 16:11 yuri-kulikov

Same problem here... I solved forcing the image to be with resizeMode stretch 😞

gbertoncelli avatar Jan 09 '19 15:01 gbertoncelli

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

ScreamZ avatar Jan 31 '19 17:01 ScreamZ

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

MichielDeMey avatar Feb 15 '19 10:02 MichielDeMey

Marvelous ! I made a workaround, i'll wait react native to update :) THanks

ScreamZ avatar Feb 15 '19 11:02 ScreamZ

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

alexandergoncharov-zz avatar Feb 21 '19 11:02 alexandergoncharov-zz

@ScreamZ What workaround did you do?

holgersindbaek avatar Mar 02 '19 09:03 holgersindbaek

Not using center mode, i was not specially requiring it for my use case.

ScreamZ avatar Mar 03 '19 12:03 ScreamZ

updating to RN 0.59.1 worked for me

ajsmth avatar Mar 22 '19 19:03 ajsmth