react-native类型检验组件prop-types
发布时间:2020-12-15 06:29:34 所属栏目:百科 来源:网络整理
导读:/** * 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 Compone
/**
* 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
>
);
}
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |