ProgressBarAndroid checks indeterminate prop type manually
Summary: Causes a YellowBox warning: "You are manually calling a React.PropTypes validation function for 'indeterminate' prop on 'ProgressBarAndroid'." Initially reported here: https://github.com/facebook/react-native/issues/9692 but closed by the creator because he switched to using ActivityIndicator. Fixed as per the guidelines here: https://facebook.github.io/react/warnings/dont-call-proptypes.html ``` /** * Sample React Native App * https://github.com/facebook/react-native * flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, View, ProgressBarAndroid } from 'react-native'; export default class AwesomeProject extends Component { render() { return ( <View style={styles.container}> <ProgressBarAndroid indeterminate={true} styleAttr="Horizontal"/> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1 } }); AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject); ``` Closes https://github.com/facebook/react-native/pull/11791 Differential Revision: D4998602 Pulled By: davidaurelio fbshipit-source-id: e210684e2f2497238e4d3d0adf2754075be81e98
This commit is contained in:
parent
eb19904cec
commit
f088bca580
|
@ -28,7 +28,7 @@ var STYLE_ATTRIBUTES = [
|
||||||
'LargeInverse',
|
'LargeInverse',
|
||||||
];
|
];
|
||||||
|
|
||||||
var indeterminateType = function(props, propName, componentName) {
|
var indeterminateType = function(props, propName, componentName, ...rest) {
|
||||||
var checker = function() {
|
var checker = function() {
|
||||||
var indeterminate = props[propName];
|
var indeterminate = props[propName];
|
||||||
var styleAttr = props.styleAttr;
|
var styleAttr = props.styleAttr;
|
||||||
|
@ -37,7 +37,7 @@ var indeterminateType = function(props, propName, componentName) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return PropTypes.bool(props, propName, componentName) || checker();
|
return PropTypes.bool(props, propName, componentName, ...rest) || checker();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue