-
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
Fix Android WebView not displaying bundled assets #17304
Fix Android WebView not displaying bundled assets #17304
Conversation
This was seen in release builds see the following issues: facebook#16133 facebook#7924
@jeanregisser I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
I am not really sure - would check the diff of the files you touched
manually to see who has been there previously :)
…On Tue, 30 Jan 2018 at 17:27 Jean Regisser ***@***.***> wrote:
@mkonicek <https://github.com/mkonicek> @astreet
<https://github.com/astreet> @grabbou <https://github.com/grabbou> who
would be best to review these changes?
Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17304 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWcxutrfl8SP-vdeQAL-AYvaggzOZJwks5tP0L1gaJpZM4RJmmw>
.
|
Yep I checked the diff and @mkonicek appeared at the top of the list (because he opensourced the initial Android version), all other contributions were from external contributors. |
@janicduplessis any chance you can review this PR? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@hramos could you help in getting this reviewed/merged? |
@jeanregisser e.g.
The url will be I try to another solution: read input stream to string, and loadData with the string.
It works. After I try, I think the scenario
Only the bundled html can keep the same situation on both platform. |
WebView PRs are on hold pending approval of the WebView proposal at react-native-community/discussions-and-proposals#3 |
@jeanregisser Feel free to submit to the new repo! https://github.com/react-native-community/react-native-webview |
Closing in favor of submitting to the new repo. |
Motivation
On Android, when using
WebView
withsource={require('./page.html')}
it displays a blank page on release builds (or whenbundleInDebug: true
is set underproject.ext.react
inandroid/app/build.gradle
).The bug is not present on iOS (debug and release) or on Android in debug mode.
The bug was reported several times:
The reason it happens is because on release builds, the native ReactWebView loads the
uri
of the bundled asset, which in this case is just the resource name:The fix I'm proposing resolves the resource name to get a valid url which can be loaded successfully by the
ReactWebView
.I've also investigated a fix for this on the JS side but it would require augmenting the
resolveAssetSource
method so it works for any type of asset for theWebView
(html, svg, png, etc) and still remains compatible whenresolveAssetSource
is used within theImage
component.Let me know what you think.
Test Plan
react-native init WebViewTest
page.html
App.js
Hello World
should be displayedRelated PRs
N/A
Release Notes
[ANDROID] [BUGFIX] [WebView] - Make source={require('./page.html')} work in release mode