Skip to content
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

Migrate RCTWebView to WKWebView. #16792

Closed
wants to merge 2 commits into from
Closed

Conversation

bowerman0
Copy link

@bowerman0 bowerman0 commented Nov 11, 2017

Motivation

#321 - Use WKWebView instead of UIWebView, because WKWebView is faster, consumes less memory, and is more stable.

This is meant to be a drop-in replacement for the existing UIWebView-based RCTWebView.

Test Plan

Used a web view loosely based on RNTester's WebViewExample.js, and tested in an ejected AwesomeProject. Browsed around the internet.

Release Notes

[IOS][ENHANCEMENT][RCTWebView] - Migrate RCTWebView to use WKWebView instead of UIWebView.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 11, 2017
@pull-bot
Copy link

pull-bot commented Nov 11, 2017

Attention: @shergin

Generated by 🚫 dangerJS

@bowerman0
Copy link
Author

Is there some way to test/fix the flow check locally? I did not change any JavaScript code in this PR, so I am not sure how this broke it.

node 6:

npm info lifecycle react-native@1000.0.0~flow: react-native@1000.0.0

react-native@1000.0.0 flow /home/circleci/react-native
flow "check"

Error: node_modules/metro-bundler/src/Bundler/util.js.flow:46
46: ): Ast {
^^^ identifier Ast. Could not resolve name

Found 1 error

npm info lifecycle react-native@1000.0.0~flow: Failed to exec flow script
npm ERR! Linux 4.4.0-97-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "flow" "--" "check"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! react-native@1000.0.0 flow: flow "check"
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the react-native@1000.0.0 flow script 'flow "check"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react-native package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! flow "check"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs react-native
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls react-native
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/circleci/react-native/npm-debug.log

and node 8:

react-native@1000.0.0 flow /home/circleci/react-native
flow "check"

Error: node_modules/metro-bundler/src/Bundler/util.js.flow:46
46: ): Ast {
^^^ identifier Ast. Could not resolve name

Found 1 error
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! react-native@1000.0.0 flow: flow "check"
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the react-native@1000.0.0 flow script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/circleci/.npm/_logs/2017-11-11T19_25_11_051Z-debug.log
Exited with code 2

@randyzhao
Copy link

randyzhao commented Nov 22, 2017

This looks really awesome. Thanks for working on it.

BTW, not only is WKWebview faster, consumes less memory and stable, but it's also required by Apple now.

Starting in iOS 8.0 and OS X 10.10, use WKWebView to add web content to your app. Do not use UIWebView or WebView.

https://developer.apple.com/documentation/webkit/wkwebview

@bowerman0
Copy link
Author

Thanks @randyzhao! I'd love to hear any issues that you (or anyone else) run into with the WKWebView version of RCTWebView.

@grabbou
Copy link
Contributor

grabbou commented Jan 4, 2018

Thanks for the PR. It's quite big, so let me get attention from few more people.

CC: @ide - I think there was an idea of moving WebView outside of React Native as its not extensively used at Facebook? If not, apologies, I probably confused that with another component.

@ide
Copy link
Contributor

ide commented Jan 4, 2018

@grabbou possibly, since we'd like to increase the React Native repo's focus on truly core parts like the C++ bridge.

@facebook-github-bot
Copy link
Contributor

@bowerman0 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.

@pull-bot
Copy link

pull-bot commented Feb 6, 2018

Warnings
⚠️

❗ Big PR - This PR is extremely unlikely to get reviewed because it touches 604 lines.

@facebook-github-bot large-pr

Attention: @shergin

Generated by 🚫 dangerJS

@bowerman0
Copy link
Author

@ide @grabbou Should the web view move into a standalone module?

@grabbou
Copy link
Contributor

grabbou commented Feb 8, 2018

That's my understanding. Also, there's already quite interesting community implementation, called react-native-wkwebview that I've been using myself.

@zachrip
Copy link

zachrip commented Feb 8, 2018

@bowerman0 @grabbou @ide one reason I'd like to see this hit rn is so that expo will have it without having to eject. So either it'd need to be supported by the expo team (they pull in some modules like this I guess) or it'd have to go in here (in order to use it in expo without ejecting). https://expo.canny.io/feature-requests/p/wkwebview-support - as you can see the request is pretty low in priority :/

@jh97uk
Copy link

jh97uk commented Feb 9, 2018

Any updates from the React team on this? This is a crucial part of my app and it would be awesome to not have to eject my expo app.

@grabbou
Copy link
Contributor

grabbou commented Feb 11, 2018 via email

@facebook-github-bot
Copy link
Contributor

@bowerman0 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.

@jh97uk
Copy link

jh97uk commented Mar 8, 2018

@grabbou sadly they aren't supportive of implementing it :( . Hopefully React Native gets it soon!

Especially as WebView on iOS is buggy slow and I also wonder about how secure it is given its deprecated since iOS 8.

@react-native-bot react-native-bot added Feature Request 🌟 Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. labels Mar 16, 2018
@hramos hramos added Type: Enhancement A new feature or enhancement of an existing feature. and removed 🌟Feature Request labels Mar 19, 2018
@hpmax00
Copy link

hpmax00 commented Aug 6, 2018

Any updates for this pr?

@RSNara
Copy link
Contributor

RSNara commented Oct 12, 2018

A new WKWebView implementation was recently merged into this repository, and then extracted to react-native-webview. Since this PR seems to be addressing a problem that was already solved, I'm going to close it.

@RSNara RSNara closed this Oct 12, 2018
jdanbrown added a commit to jdanbrown/birdgram that referenced this pull request Jan 4, 2020
…ted UIWebView error from app store

- Problem
  - Email after upload: `ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs`
  - Our react-native is really old and still has RCTWebView
- Solution
  - Rip out RCTWebView
    - `find node_modules/react-native/ | grep RCTWebView | xargs trash`
    - From facebook/react-native#26255 (comment)
  - Future react-native versions move WebView out to https://github.com/react-native-community/react-native-webview
    - facebook/react-native#16792 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Platform: iOS iOS applications. Ran Commands One of our bots successfully processed a command. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.