-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Document new asset system #3545
Conversation
By analyzing the blame information on this pull request, we identified @brentvatne, @vjeux and @mkonicek to be potential reviewers. |
@frantic updated the pull request. |
|
||
![](/react-native/img/StaticImageAssets.png) | ||
Packager will bundle and server image corresponding to device's screen density, e.g. on iPhone 5s `check@2x.png` will be used, on Nexus 5 – `[email protected]`. If there is no image matching screen density, closest best option will be selected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundle and server image
bundle and serve the image
If there is no image matching screen density, closest
If there is no image matching the screen density, the closest
Looks amazing @frantic! After those small grammar fixes let's 🚀 |
👍 This means no need to add images to xcode now? Edit: @brentvatne answered this on discord. Now, we won't need to add images to xcode. |
@frantic would it consider 1.5x and 4x for android? |
@chirag04 yes, see https://github.com/facebook/react-native/blob/master/private-cli/src/bundle/getAssetDestPathAndroid.js#L13, we map |
|
||
*This process is currently being improved, a much better workflow will be available shortly.* | ||
1. Same system on iOS and Android |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing .
at the end of the sentence
Thanks for the review @brentvatne, I'm really bad with |
@frantic updated the pull request. |
Oh my god this is good news! High five everyone involved! |
Looks awesome @frantic! |
That's super awesome! |
VERY awesome! |
This is great! Just curious, are there docs already written / upcoming that document how to release apps using the new asset system? I noticed the |
I'll submit a pr tomorrow or on Thursday to update the docs for the cli :) |
awesome, thanks @martinbigio! |
Hey @shishircc, note that for this system to work we need to add a step to Xcode build process that would collect all required images and package them into the app. See be70e32. TL;DR is – either regenerate your Xcode project using
Note that the location for main.jsbundle has changed and you no longer need to manually run |
Thanks @frantic , How is the automatic offline bundling triggered ? |
This will be part of 0.14 release, the current version is 0.13.2. If you want to try this feature before the release, do the following:
|
@frantic updated the pull request. |
@frantic I generated the project today using the master branch(modified cli). Xcode cannot build the new generated project. i get However the build works fine when i check cc @foghina |
@chirag04 can you open a separate issue for this and assign to me? |
Does this mean that the
|
Hmmm also curious about this ☝️ Neither v0.14.0-rc nor v0.14.0 make mention of this being a breaking change |
@frantic can you have a look into this? It looks similar to what I'm seeing on travis on the 0.14-stable branch: https://travis-ci.org/facebook/react-native/jobs/89546902#L1272 |
Also cc @martinbigio |
@jaredly should just work, seem like a bug. FYI you can still use |
2 questions about the Asset system: #1- If I understand correctly, there will be no way to have images updated without updating the native portion of an app? I mean, one nice thing about react-native is the ability to update (the non-native portion of) apps instantly in the field. #2- I see the names need to be statically defined. Would there be a way to have a simple wildcard pattern, something like (Not sure this is the right place to ask, please redirect me anywhere more appropriate if not) |
|
I had an issue when I tried to offline bundle the app, even after upgrading the |
I ran react-native upgrade but obviously couldn't answer Y to all overwrites as majority of existing project config would be lost so I had to be selective. Nonetheless, the run script task was not added. Separately, the new run script task makes the assumption that the entry point has to be index.ios.js - this is an artificial and limiting constraint in my view . It should be passed in as param to the script. Also, locations it uses are artificial and limiting - they are user project dependent really... Still, cannot get static images to work with the offline bundle deployment in Xcode...have not even tried Android..this is React 0.18... The Awesome Project in Xcode does not show any references to assets folder and iOS is not finding the static images...I have not idea where the images should be placed and how they should be referenced from Xcode any longer... |
You can press "d" to view the diff of what's changed, and do those changes manually.
The
Try creating a project from scratch and port your changes over. This is the easiest way.
You can place them anywhere you want and reference them just like you reference javascript files. |
@satya164 - thanks for your hints..commented on them below based on my experience...
Yes, did that. The run script task was never added to the Xcode project ...
Yes. but all documentation scattered around refers to running the pre-canned script react-native-code.sh and supposedly this script is to be added by react-native init or upgrade so as you can image someone will be scratching their head to figure out what is going on unless they go into this sh script and modify things around. Furthermore, since the script does not take any params, the whole script has to be duplicated in order to run it against a different entry point - not a good thing.
|
Regarding As for the entry point – we rely on convention over configuration here. If you think that the process of customizing the entry point is common enough, please send a PR. We have addressed a similar issue earlier by adding a configuration option. The bug your experienced regarding whole program optimizations deserves a separate issue and is not related to this PR. I suspect your |
cc @mkonicek @martinbigio
@brentvatne mind doing a quick proofreading? :)