react-native type checking component 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' ; //Type checking component
//home
export defaultclassApp extendsComponent {

static propTypes = {
onButtonPress:PropTypes .func , // callback function
}
onButtonPress = () =>{
console. log( ip);
}

render() {
return (
< View >
< Button
onPress= {this. onButtonPress }
title= "Learn More"
color= "#841584"
accessibilityLabel= "Learn more about this purple button"
/>
</ View >
);
}
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325852323&siteId=291194637