react-native类型检验组件prop-types

版权声明:竹子原创,未经允许不得转载 https://blog.csdn.net/u010411264/article/details/79974746
/**
* Create by bamboo on 2018-04-13
*
*/
import React,{Component} from 'react';
import { View, Text, Button,} from 'react-native';
import PropTypes from 'prop-types';//类型检验组件
//主页
export default class App extends Component {

static propTypes = {
onButtonPress:PropTypes.func, // 回调函数
}
onButtonPress = ()=>{
console.log(ip);
}

render() {
return (
<View>
<Button
onPress={this.onButtonPress}
title="Learn More"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
</View>
);
}
}
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页