react-native PropTypes
来源:互联网 发布:金融机构利用电话网络 编辑:程序博客网 时间:2024/05/17 06:56
在学习react-native过程中,设置自定义组件 PropTypes遇到了个坑
import React, { Component , PropTypes} from 'react';import { Platform, StyleSheet, Text, View} from 'react-native';export default class PropsTest extends Component<{}> { static defaultProps={ name:'小红', age:10 } static propTypes={ name:PropTypes.string, age:PropTypes.number, sex:PropTypes.string.isRequired } render() { return <View> <Text style={{fontSize:20,backgroundColor:'red'}}>姓名:{this.props.name}</Text> <Text style={{fontSize:20,backgroundColor:'red'}}>年龄:{this.props.age}</Text> <Text style={{fontSize:20,backgroundColor:'red'}}>年龄:{this.props.sex}</Text> </View>; }}一直报错,找了N多方法,最后终于解决import PropTypes from 'prop-types';
阅读全文
0 0
- react-native PropTypes
- React Native 报PropTypes 问题
- React Native Don't Call PropTypes Warning
- Manually calling a React.PropTypes validation React native
- react PropTypes
- React.PropTypes
- react native关于 从react中引入PropTypes报错的问题
- React之PropTypes
- React 的PropTypes
- react教程之PropTypes
- React的PropTypes 验证
- React之PropTypes属性
- import {PropTypes} from 'react'; PropTypes is undefined
- React Native报错unddefined is not an object(evaluating ‘_reactnative.propTypes’)解决办法
- 解决:react native使用TabNavigator报错 PropTypes has been moved to a separate package...
- react-native-baidu-map undefined is not an object(evaluting 'a.PropTypes.bool')
- React组件属性类--propTypes
- React组件的属性PropTypes
- 【原创】纯干货,Spring-data-jpa详解,全方位介绍。
- Arcgis server配置oracle客户端
- 深度学习之RBM
- keras下的tensorboard
- TCP协议 拥塞控制算法
- react-native PropTypes
- 在for循环里用time,datetime等的小坑
- L1-033. 出生年
- java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException
- C# 实现自动ADSL拨号(基于bat)
- Hadoop单机伪分布式安装
- DAS、SAN、NAS
- C#对Oracle数据库的语句进行参数化
- Linux日志