-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Webview unable to load local assets or from CDNs along with window.postMessage not working in iOS release build #20226
Comments
I've got the same problem when trying to render a local HTML file in a WebView. When building an iOS release, I get a blank white screen. It works perfectly fine on the iOS Simulator. I'm running React Native 0.56. I have another project running 0.55.4 and it this problem does not exist. I added Reproducible: import content from './index.html';
<WebView
source={content}
scalesPageToFit={Platform.select({
ios: true,
android: false,
})}
startInLoadingState
renderLoading={() => <Loader />}
/> The HTML file can contain anything. It never resolves from |
I also faced a similar problem and this #19986 (comment) resolved it. Not sure what the issue is. |
@echo8795 Thanks for the update, this is working fine. |
@sja1n I think I understand your use case, I had a similar requirement where I was creating a stringified html document for webviews and i had to include js libraries from inside the app bundle. So I added my js and css and font files inside my bundles by adding it I then used
and the html went something like this
And window.postMessage works for me in production build as well. I think this should help you out. |
Yeah I think maybe I all I needed was to know how to give proper path for html file in ios, Thanks @echo8795 for the info, I'll definitely try this and update. |
Migrated to react-native-webview/react-native-webview#21 and can be closed here. |
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 310.16 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.5.1 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 26.0.3, 27.0.3
API Levels: 26, 27
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: ^0.56.0 => 0.56.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
Description
I am using webview to display chart for my app using
chartjs
andjquery
library I am able to view charts fine in iOS debug mode but in release config, all I get is a white screen, I tried to check if atleastwindow.postMessage
was working using setinterval code in my .html file, but I dont get any response from webview.To check for window.postMessage I have also tried to possible solution from issue , still its not working
I have tried to inject the complete html code as well instead of serving the html as local asset file, still not success.
This issue is only present in iOS, works perfectly fine for android.
The text was updated successfully, but these errors were encountered: