
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
react-native-webkit-webview
Advanced tools
Forked from react-native-webview-crosswalk
Cross-platform Webview component,With better performance on android.
react-native >=0.32.0
, react >= 15.3.0
npm install react-native-webkit-webview --save
mkdir android/app/libs
cp node_modules/react-native-webkit-webview/libs/xwalk_core_library-22.52.561.4.aar android/app/libs/
android/setting.gradle
...
+ include ':CrosswalkWebView', ':app'
+ project(':CrosswalkWebView').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webkit-webview')
android/build.gradle
...
allprojects {
repositories {
mavenLocal()
jcenter()
+ flatDir {
+ dirs 'libs'
+ }
}
}
android/app/build.gradle
...
dependencies {
...
+ compile (name: "xwalk_core_library-22.52.561.4", ext: "aar")
+ compile project(':CrosswalkWebView')
}
Register package :
In android/app/src/main/java/com/YOUR_PROJECT_NAME/MainActivity.java
+ import com.jordansexton.react.crosswalk.webview.CrosswalkWebViewPackage;
public class MainApplication extends Application implements ReactApplication {
......
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
+ new CrosswalkWebViewPackage() // <--- add this line
);
}
......
}
// DemoComponents.js
import React,{ Component } from 'react'
import { View,TouchableHighlight,Text } from 'react-native'
import WebkitView from 'react-native-webkit-webview'
import localDemoPage from './demoPage.html'
export default class DemoComponents extends Component{
render(){
return (
<View>
<TouchableHighlight onPress={ this.passMessageToWebpage }>
<Text>Tell webpage some message</Text>
</TouchableHighlight>
<WebkitView
source={ localDemoPage // local file usage}
source={{ uri:'http://www.demo.com/path' //link usage }}
injectedJavascript="setTimeout(function(){document.write('WONDERFUL')},1000)"
onMessage = { this.messageHandler }
ref={ (webkitView) => { this.webkitView = webkitView } }
/>
</View>
)
}
passMessageToWebpage = () => {
this.webkitView.postMessage('hello there')
}
messageHandler = (ev) => {
console.log(ev)
}
}
<!-- demoPage.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
window.addEventListener('message',(ev) => {
console.log(ev);
})
</script>
</body>
</html>
MIT
FAQs
Better performance WebView component
The npm package react-native-webkit-webview receives a total of 7 weekly downloads. As such, react-native-webkit-webview popularity was classified as not popular.
We found that react-native-webkit-webview demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.