由于 x5 对 react-native 项目兼容性很差,已经放弃维护和更新这个项目
X5's WebView for React Native on Android (Interfaces based on ReactNative's WebView Component)
- 0.0.1:
react-native >= 0.33.0
,react = 15.3.1
- Install from npm
npm i react-native-x5 --save
- Link native library
You can use react-native-cli:
react-native link react-native-x5
Or rnpm:
rnpm link react-native-x5
Add those lines to AndroidManifest.xml in your project.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
import WebView from 'react-native-x5';
Totally same as WebView for react-native
Additional methods:
- WebView.getX5CoreVersion(callback)
static
get X5's core version through callback
WebView.getX5CoreVersion(function callback (version) {
console.log(version); // get `0` if X5 is not installed correctly
});