mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-12 12:08:07 +08:00
Change getDefaultProps to ES7 property initialiazers for default props (#9241)
and add PropType validation * getDefaultProps is not available in ES6 class style declaration
This commit is contained in:
@@ -31,11 +31,12 @@ import React, { Component } from 'react';
|
||||
import { View, Text } from 'react-native';
|
||||
|
||||
export default class MyScene extends Component {
|
||||
getDefaultProps() {
|
||||
return {
|
||||
title: 'MyScene'
|
||||
};
|
||||
}
|
||||
static propTypes = {
|
||||
title: React.PropTypes.string,
|
||||
};
|
||||
static defaultProps = {
|
||||
title: 'MyScene',
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user