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

/**
* 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 >
);
}
}

猜你喜欢

转载自blog.csdn.net/u010411264/article/details/79974746