Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Commit c694075

Browse files
author
guohui.deng
committed
使用prop-types定义属性
1 parent 4c2544c commit c694075

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Diff for: index.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
ActivityIndicator
99
} from 'react-native';
1010

11+
import PropTypes from 'prop-types';
12+
1113
const styles = StyleSheet.create({
1214
container: {
1315
position: 'absolute',
@@ -109,16 +111,16 @@ class BusyIndicator extends React.Component {
109111
}
110112

111113
BusyIndicator.propTypes = {
112-
color: React.PropTypes.string,
113-
overlayColor: React.PropTypes.string,
114-
overlayHeight: React.PropTypes.number,
115-
overlayWidth: React.PropTypes.number,
116-
size: React.PropTypes.oneOf(['small', 'large']),
117-
startVisible: React.PropTypes.bool,
118-
text: React.PropTypes.string,
119-
textColor: React.PropTypes.string,
120-
textFontSize: React.PropTypes.number,
121-
textNumberOfLines: React.PropTypes.number
114+
color: PropTypes.string,
115+
overlayColor: PropTypes.string,
116+
overlayHeight: PropTypes.number,
117+
overlayWidth: PropTypes.number,
118+
size: PropTypes.oneOf(['small', 'large']),
119+
startVisible: PropTypes.bool,
120+
text: PropTypes.string,
121+
textColor: PropTypes.string,
122+
textFontSize: PropTypes.number,
123+
textNumberOfLines: PropTypes.number
122124
};
123125

124126
BusyIndicator.defaultProps = {

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"react-native": "=0.26.0",
3838
"react-native-mock": "=0.2.5",
3939
"sinon": "=1.17.4",
40-
"sinon-chai": "=2.8.0"
40+
"sinon-chai": "=2.8.0",
41+
"prop-types": "^15.6.0"
4142
},
4243
"repository": {
4344
"type": "git",

0 commit comments

Comments
 (0)