1.所有的属性类型

react-native 组件默认属性(defaultProps) 及 属性类型验证(PropTypes)

2.代码

import PropTypes from 'prop-types';

type Props = {};
export default class App extends Component<Props> {
  static defaultProps = {
    name: '张三'
  }

  static propTypes = {
    name: PropTypes.string
  }

  render() {
    return (
      <View style={styles.container}>

      </View>
    );
  }
}

.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
相关资源
相似解决方案