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

Images not showing in release build (code-push can't require assets, need to explicitly use ms-appx/ms-appdata and lose require benefits) #7780

Closed
omdxp opened this issue May 15, 2021 · 7 comments
Labels
Area: Image enhancement Needs: Dev Design Recommend: Not Planned Recommend that issue should be given Not Planned milestone.
Milestone

Comments

@omdxp
Copy link

omdxp commented May 15, 2021

Environment

  1. npx react-native --version: 4.13.1
  2. npx react-native info:
System:
    OS: Windows 10 10.0.19592
    CPU: (4) x64 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz
    Memory: 3.01 GB / 15.88 GB
  Binaries:
    Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 23, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3, 31.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0
  IDEs:
    Android Studio: Version  4.1.0.0 AI-201.8743.12.41.7199119
    Visual Studio: 16.9.31112.23 (Visual Studio Professional 2019)
  Languages:
    Java: 1.8.0_242-release
    Python: 3.9.2
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.2 => 0.63.2
    react-native-windows: ^0.63.0-0 => 0.63.18

Steps To Reproduce

  1. In debug all images can be displayed.
  2. When I try to build in release all images cannot be displayed.

Expected Results

Images can be displayed in release build.

Example code snippet

<Image 
   source={require('./assets/images/logo.png')}
/>
@omdxp omdxp added the bug label May 15, 2021
@ghost ghost added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label May 15, 2021
@omdxp
Copy link
Author

omdxp commented May 17, 2021

I have looked for this and what I found as a solution is to copy logo.png inside Assets folder of the UWP project and then to get the image from React Native you should type the following:

<Image 
   source={{uri: 'ms-appx:///Assets/logo.png'}}
/>

@omdxp omdxp closed this as completed May 17, 2021
@ghost ghost removed the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label May 17, 2021
@acoates-ms acoates-ms reopened this May 17, 2021
@acoates-ms
Copy link
Contributor

We should make sure that the default project is configured in a way that the normal import of an image works. The image should be added to the appx and work in release. -- If it isn't, then that's something we will look into.

@acoates-ms acoates-ms added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label May 17, 2021
@chrisglein chrisglein added Area: Image and removed Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) labels May 17, 2021
@chrisglein chrisglein added this to the 0.66 milestone May 17, 2021
@aalbaharnah
Copy link

@Omar-Belghaouti @acoates-ms @chrisglein

This is related to react-native-code-push and only happens with release bundle if the root component is wrapped with codePush higher-order component

I think it's because react native assets not being bundled in code push JS bundle

This issue might help
microsoft/react-native-code-push#699

@omdxp
Copy link
Author

omdxp commented May 21, 2021

@aalbaharnah Thanks for the remark, I did in fact use code push in this project. Never thought it's because of it. But nevertheless, I think code push must bundle all the assets!

@asklar
Copy link
Member

asklar commented May 27, 2021

CC @qmatteoq FYI - something to look out for

@asklar
Copy link
Member

asklar commented May 27, 2021

tagging to bring this back to triage

@asklar asklar added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label May 27, 2021
@chrisglein chrisglein added enhancement Needs: Dev Design and removed Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) bug labels May 27, 2021
@chrisglein chrisglein changed the title Images not showing in release build Images not showing in release build (code-push can't require assets, need to explicitly use ms-appx/ms-appdata and lose require benefits) May 27, 2021
@chrisglein chrisglein modified the milestones: 0.66, Backlog May 27, 2021
@Andriiklymiuk
Copy link

What is the status of that one?
Still happening on rn 0.65.1

@marlenecota marlenecota added the Recommend: Not Planned Recommend that issue should be given Not Planned milestone. label Aug 29, 2023
@chrisglein chrisglein closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Image enhancement Needs: Dev Design Recommend: Not Planned Recommend that issue should be given Not Planned milestone.
Projects
None yet
Development

No branches or pull requests

7 participants