-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Upstream changes to resolveAssetSource.js #10619
Comments
Needed for the workaround for #10614? There is logic for bundled apps to resolve these. Is this just needed for unbundled apps? Sounds like there's some offline discussion about how may want to retire the current |
Related: #10620 |
No, workaround is for #10620>
What's the offline discussion? I don't think there has ever been |
Flagging to discuss. Issue has milestone but no assignee. |
Need to look at this issue when we look more closely at the image pipeline for Fabric. @rozele We spent some time discussing this in triage and it's clearly deeper than expected at first glance. Shall we cover in one of the Wednesday meetings? |
@jonthysell The fix in #10621 would change behavior in both packaged and unpackaged apps. Previously, the SourceCodeModule would return empty string for "bundled" apps (i.e., those not loaded from the packager server). Now, SourceCodeModule will return the directory that the bundle was loaded from (which is what it does on iOS and Android). For packaged apps, the bundle path is generally something like It also makes it so that image source URL rewrite logic is the same code path across dev and prod (i.e., via JavaScript / resolveAssetSource), which is probably a good thing / may lead to fewer bugs. |
Summary
We need to override Libraries/Image/resolveAssetSource.js for unpackaged apps. There are assumptions in the upstream version of resolveAssetSource.js that the root bundle path is of the form
<protocol>://<path>
, and unpackaged apps may use bundle root paths of the form "C:<path>" or otherwise.Motivation
We ship both packaged and unpackaged versions of our app. We should support both scenarios.
Currently,
react-native-windows
has a bug where the source code URL for bundled apps is an empty string. We'll be fixing this so that apps can reliably use theImage.resolveAssetSource
API from React Native to get a fully qualified path to a packaged asset.In order for this bug fix to work with unpackaged apps, we need eliminate the assumption that bundle paths match the form
<protocol>://<path>
.Basic Example
For example, in our app, we have a context menu native module that takes in an object including the URI for the Icon to use for a context menu item. It should be possible to use the
Image.resolveAssetPath
API to resolve the fully qualified asset path for the icon.E.g.,
Without this change, unpackaged app icon sources will always be resolved to
file://icon.png
and we need native logic in the context menu module to strip thefile://
prefix and prepend the bundle root path from the instance settings snapshot.I'd prefer that we have common logic that is reusable for all modules that works in roughly the same way
resolveAssetSource
behaves on other platforms.Open Questions
No response
The text was updated successfully, but these errors were encountered: