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

你可能感兴趣的:(React,Native)