Skip to content

Instantly share code, notes, and snippets.

@zaguiini
Last active January 4, 2018 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaguiini/42c0a45e68d4f14d695109229a2d6aa0 to your computer and use it in GitHub Desktop.
Save zaguiini/42c0a45e68d4f14d695109229a2d6aa0 to your computer and use it in GitHub Desktop.
import { PureComponent } from 'react'
import { Platform, WebView as WebViewAndroid } from 'react-native'
import WebViewIOS from 'react-native-wkwebview-reborn'
const webviewRef = 'webview'
...
class App extends PureComponent {
...
webviewProps = {
ref: webviewRef,
onNavigationStateChange: this.handleNavigationStateChange.bind(this),
onMessage: this.handleMessage.bind(this),
javaScriptEnabled: true,
source: {
uri: 'https://yourloginurl.com',
}
}
render() {
return (
Platform.OS === 'ios' ?
<WebViewIOS {...this.webviewProps} /> :
<WebViewAndroid {...this.webviewProps} />
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment