Files
react-native-webview-bridge/example/Sample1/index.ios.js
T

63 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-07-07 15:37:30 -04:00
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
2015-07-08 12:24:08 -04:00
WebView
2015-07-07 15:37:30 -04:00
} = React;
2015-07-08 12:24:08 -04:00
var WebViewBridge = require('react-native-webview-bridge');
console.log(WebViewBridge);
2015-07-07 15:37:30 -04:00
var Sample1 = React.createClass({
2015-07-08 12:24:08 -04:00
componentDidMount: function () {
//this.refs.myWebView.eval("window.test='cool'");
},
onNavigationStateChange: function () {
console.log('called onNavigationStateChange');
},
2015-07-07 15:37:30 -04:00
render: function() {
2015-07-08 12:24:08 -04:00
var url = "http://yahoo.com";
2015-07-07 15:37:30 -04:00
return (
2015-07-08 12:24:08 -04:00
<WebViewBridge
ref="myWebView"
onNavigationStateChange={this.onNavigationStateChange}
url={url}/>
2015-07-07 15:37:30 -04:00
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('Sample1', () => Sample1);