-
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
Use WKWebView instead of UIWebView #321
Comments
It also comes with problems. Would like to differentiate between the 2 as separate components. |
@drkibitz What kinds of problem? The only thing I can think of is that it requires iOS 8. Maybe we can choose |
A relevant fragment of the discussion:
|
We should have WebViewIOS and WKWebViewIOS instead of a generic WebView component. Anyone up for the renaming and providing both implementations? |
While still buggy, it looks like Telerik has implemented a |
+1 on @vjeux's suggestion. |
Why do we need both? |
@spicyj we should be able to expose all the platform features and let the developer pick the one that makes sense for their use case. |
I agree in principle but my understanding is that UIWebView is preferable only if you need a synchronous API (or need to do low-level configuration), neither of which are super compelling reasons from the JS side. I'm okay either way I guess but the |
Isn't there still an issue with WKWebView in that it cannot load from a local resource, it has to load over http? Telerik included a mini-http server in the Cordova plugin to workaround this issue, as far as I remember. Just mentioning, as it may not be as simple as a drop-in replacement. |
+1 I use Semantic-ui to build my mobile app on iOS , and it kind of slow , maybe the WKWebView will speed it up |
Does anyone happen to know if the JIT is enabled in JSContext on desktop? |
^ cc @ide |
Labeled as good first task as per @vjeux's comment:
|
I second @joewood concern about the WKWebView being buggy. You can't load html from a local resource, nor does it support the html5 app cache, so pages cannot work offline. This is not an issue with standard WebView. |
I'm going to close this because it doesn't seem to be going anywhere - I think there would be some value in having a |
Agreed @brentvatne it would be nice as a separate component. Also, FYI in IOS9 there will be a SFSafariViewController |
@oveddan - ooh, looks cool! shares cookies with Safari |
@brentvatne I'll work on creating WKWebView component - I think it could be useful with something like what @joewood mentioned Telerik did, with some sort of min-http server, that serves a local file over an http server. If the packager can serve html, then someone can build something similar for these static files. That mini-file-server would probably be a separate project. |
@oveddan Any progress on this? I'd like to use WKWebView for SceneVR because the javascript performance is much higher than UIWebView. |
@bnolan Sorry, no I haven't had a chance to work on this, nor do I have time in the near future to. |
I am actively working on this, and have a nearly complete implementation of the API currently supported by React Native for UIWebView. I should be ready to open source the project next week, and then I'll open a PR for it here. This is my first attempt to contribute to React Native, so I would definitely expect the PR to go through no small amount of scrutiny by the core team as I revise it, but I plan to release it as a standalone first. There is also qrush/react-native-wkwebview which is barebones but works if you need something right away. I used it for a little while myself before deciding to fully implement it. The main differences between Nick Quaranto's project and what I'm working on are:
It's based on React Native |
Just want to chime in that WKWebView support (in addition) would be most welcomed, for performance reason. For http webviews, WKWebView in iOS 9 is pretty much superior now with no downside. And for reference, in iOS 9 there's also Safari View Controller which chiefly gives users webviews that shares same login cookies as from Safari itself, but at cost of no ability to inject JS or control what goes on inside that Safari View. There's support for RN at https://github.com/naoufal/react-native-safari-view |
@jordansexton do you have progress on this? Would be an enabler for me. I am a backend dev, learning react.js seems a bit steep to me. So I am looking to have vue.js in a (decent) webview and use react-native as a backend and for heavy lifting. Sorry all. |
I completed this but never open sourced it as I no longer use it. I use the Jordan
|
@jordansexton I'd love to see what you worked on! |
@jordansexton Would also like to see it! |
@bowerman0 I echo @ide's comment and it's something I've commented on other On our side, we do need to agree on what the future of the build-in |
@fungilation how do you think |
That and de-fragmentation. If |
While WebView be the "official way to do it", that's what 99% of developers will use. IMO it doesn't necessarily need to be merged, a note in the docs like it was made with react-navigation could be enough. But merged in the core passes more confidence that it will be maintained. |
Maintainer of IMO, React Native should focus on the "core" bridges and this component should happily live as a 3rd party component. This makes it easier for people to actually contribute to this project. Also, it means flexible release schedule (as opposed to the monthly release schedule of React Native) And I agree with @brunolemos that improving React Native docs is a better way to make people more aware of the decision regarding UIWebView and WKWebView and point them to the solution. |
Could More people see and choose to adopt EDIT: as @bowerman0 says below, visibility is a big issue. |
@hramos The |
UIWebView is officially deprecated in iOS 12 (I don't think it was in iOS 11, but forgive me if I'm wrong about that) https://developer.apple.com/documentation/uikit/uiwebview |
This comment has been minimized.
This comment has been minimized.
@hramos any word on if there are going to be instructions on building on iOS from source anytime soon? I would love to poke around on this and other issues, but as I believe we discussed before, the only instructions to build from source are for Android and they are here https://facebook.github.io/react-native/docs/building-from-source.html. Am I missing something? Are there any guides for building from source for iOS? |
Also/ or if someone could explain it to me, I would be happy to make a PR to the docs |
I opened this issue over 3 years ago. The lack of action on it has once again blocked a major feature. |
@ckknight If lack of action is blocking a major feature for you, consider using https://github.com/CRAlpha/react-native-wkwebview. We are using it in production with no problems. |
👋 related to this whole You can follow along and give feedback here: react-native-community/discussions-and-proposals#3 |
Because https://github.com/react-native-community/react-native-webview uses WKWebView by default, I'm not planning to migrate this issue over there. This issue can probably be closed. |
Sounds good to me - closing |
Should we consider WebView to be officially deprecated from RN and migrated to react-native-community? |
Basically, yes. It will be properly announced when 0.57.0 is released but yeah, that's what will happen. |
It would be nice if there were a way to use
WKWebView
instead ofUIWebView
when using the<WebView>
component, asWKWebView
has substantial performance benefits.The text was updated successfully, but these errors were encountered: