React-Native schema跳转

前端之家收集整理的这篇文章主要介绍了React-Native schema跳转前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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 (

猜你在找的React相关文章