How could I scroll from left to right to return to web browsing?

In the web view, I want to scroll from left to right to go back, just like what safari did. what should I do?

+5
source share
1 answer

TL / DR: Currently, you will need a third-party package for this. Use action-native-wkwebview-reborn and set allowsBackForwardNavigationGestures to true. Example:

WebView.ios.js :

 import React from 'react'; import WKWebView from 'react-native-wkwebview-reborn'; export default (props) => <WKWebView allowsBackForwardNavigationGestures {...props} /> 

WebView.js

 import { WebView } from 'react-native'; export default WebView; 

This is a replacement for replacement, so you do not need to change the code.


Why:

React Native's WebView component uses a UIWebView under the hood, which is no longer recommended by Apple:

wkwebview

It has poorer performance and does not support many features such as 3D Touch and swipe back.

Join this discussion , so edit your own updates to your main component.

+2
source

Source: https://habr.com/ru/post/1243841/


All Articles