Mobile

React Native 0.57 coming soon with new iOS WebViews

2 min read

WebView is used to display web content in your iOS applications.Yesterday, React Native announced a new native iOS backend to the WebView component that uses WKWebView. This WebView component will be available in the upcoming React Native 0.57 release.

Apple has discouraged the use of UIWebViews for a long time. This is due to its being formally deprecated in the upcoming months. It is advised that you use the WKWebView class instead of using UIWebView for the apps that run in iOS 8 and above.

You can use the useWebKit property to opt into this implementation:

What problems does WKWebView solve?

Earlier, to embed web content in our applications we had two options, UIWebView and WKWebView.

UIWebView is the original WebView introduced in 2.0. It is known to have some pitfalls and problems. The main drawback is that it has no legitimate way to facilitate communication between the JavaScript running in the WebView and React Native. The newly introduced WKWebView aims to solve this problem. Other benefits of WKWebView over UIWebView include faster JavaScript execution and a multi-process architecture.

What to consider when switching to WKWebView?

You must avoid using the following properties, for the time being:

  • Using automaticallyAdjustContentInsets and contentInsets may result in inconsistent behavior. When we add contentInsets to UIWebView, the viewport size changes (gets smaller, if the content insets are positive). In case of WKWebView, the viewport size remain unchanged.
  • If you use the backgroundColor property there is a chance that WKWebView may render transparent backgrounds differently from UIWebView and can also flicker into view.

Per React Native community, WKWebView doesn’t support the scalesPageToFit property. Hence, they couldn’t implement this on the WebView React Native component.

To know more about the new WebViews, check out their announcement on React Native’s official website and their GitHub repository.

Read Next

Apple releases iOS 12 beta 2 with screen time and battery usage updates among others

React Native 0.56 is now available

Apple releases iOS 11.4 update with features including AirPlay 2, and HomePod among others

Bhagyashree R

Share
Published by
Bhagyashree R
Tags: AppleiOS

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago