demo 地址:https://git.oschina.net/tomcode/react-native-schema.git
一,index.android.js内容
var React = require(‘react-native’);
var {
View,
AppRegistry,
} = React;
var OpenURLButton = require(‘./openurl’);
var schema = React.createClass({
render: function() {
return (
https://www.baidu.com‘} />
);
},
});
AppRegistry.registerComponent(‘schema’,() => schema);
二OpenURLButton button空间内容
‘use strict’;
var React = require(‘react-native’);
var {
IntentAndroid,
StyleSheet,
Text,
TouchableNativeFeedback,
View,
ToastAndroid,
} = React;
var OpenURLButton = React.createClass({
propTypes: {
url: React.PropTypes.string,
},
handleClick: function() { IntentAndroid.canOpenURL(this.props.url,(supported) => { //判断当前uri是否可以打开 if (supported) { IntentAndroid.openURL(this.props.url); } else { ToastAndroid.show(“不能识别当前uri”,ToastAndroid.SHORT); } }); },//返回当前button组件显示的视图,这里是一个TouchableNativeFeedback render: function() { return (