Fix Flow errors at declaration of most major library components
Summary: The relevant changes in the PR are to Libraries/StyleSheet/EdgeInsetsPropType.js; the rest are just removals of FlowIgnores. The definition of the relevant types is [here](https://github.com/facebook/flow/blob/master/lib/react.js#L262-L271). The long and short of it is that for whatever reason, Flow is unable to realize that `ReactPropsChainableTypeChecker` is a subtype of `ReactPropsCheckType` unless we assert it. Once we explicitly hint this to the typechecker, it realizes that `EdgeInsetsPropType` is indeed a valid React PropType, and stops complaining that it isn't. Closes https://github.com/facebook/react-native/pull/16437 Differential Revision: D6109742 Pulled By: sahrens fbshipit-source-id: e4e10720b68c912d0372d810409f389b65d7f4b1
This commit is contained in:
parent
7e0b7ef8d0
commit
833b27483b
|
@ -78,9 +78,6 @@ type DefaultProps = {
|
||||||
* AppRegistry.registerComponent('App', () => App)
|
* AppRegistry.registerComponent('App', () => App)
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
|
|
||||||
* suppresses an error when upgrading Flow's support for React. To see the
|
|
||||||
* error delete this comment and run Flow. */
|
|
||||||
const ActivityIndicator = createReactClass({
|
const ActivityIndicator = createReactClass({
|
||||||
displayName: 'ActivityIndicator',
|
displayName: 'ActivityIndicator',
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
|
@ -37,7 +37,6 @@ type DefaultProps = {
|
||||||
* @keyword checkbox
|
* @keyword checkbox
|
||||||
* @keyword toggle
|
* @keyword toggle
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
let CheckBox = createReactClass({
|
let CheckBox = createReactClass({
|
||||||
displayName: 'CheckBox',
|
displayName: 'CheckBox',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
|
|
@ -36,7 +36,6 @@ type Event = Object;
|
||||||
* the user's change will be reverted immediately to reflect `props.date` as the
|
* the user's change will be reverted immediately to reflect `props.date` as the
|
||||||
* source of truth.
|
* source of truth.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const DatePickerIOS = createReactClass({
|
const DatePickerIOS = createReactClass({
|
||||||
displayName: 'DatePickerIOS',
|
displayName: 'DatePickerIOS',
|
||||||
// TOOD: Put a better type for _picker
|
// TOOD: Put a better type for _picker
|
||||||
|
|
|
@ -46,7 +46,6 @@ const viewRef = 'VIEW';
|
||||||
* It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard.
|
* It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard.
|
||||||
* It can automatically adjust either its position or bottom padding based on the position of the keyboard.
|
* It can automatically adjust either its position or bottom padding based on the position of the keyboard.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const KeyboardAvoidingView = createReactClass({
|
const KeyboardAvoidingView = createReactClass({
|
||||||
displayName: 'KeyboardAvoidingView',
|
displayName: 'KeyboardAvoidingView',
|
||||||
mixins: [TimerMixin],
|
mixins: [TimerMixin],
|
||||||
|
|
|
@ -24,7 +24,6 @@ var requireNativeComponent = require('requireNativeComponent');
|
||||||
/**
|
/**
|
||||||
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
|
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
var ProgressViewIOS = createReactClass({
|
var ProgressViewIOS = createReactClass({
|
||||||
displayName: 'ProgressViewIOS',
|
displayName: 'ProgressViewIOS',
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
|
@ -72,7 +72,6 @@ if (Platform.OS === 'android') {
|
||||||
* __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true
|
* __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true
|
||||||
* in the `onRefresh` function otherwise the refresh indicator will stop immediately.
|
* in the `onRefresh` function otherwise the refresh indicator will stop immediately.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const RefreshControl = createReactClass({
|
const RefreshControl = createReactClass({
|
||||||
displayName: 'RefreshControl',
|
displayName: 'RefreshControl',
|
||||||
statics: {
|
statics: {
|
||||||
|
|
|
@ -49,7 +49,6 @@ type Event = Object;
|
||||||
* />
|
* />
|
||||||
* ````
|
* ````
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
var SegmentedControlIOS = createReactClass({
|
var SegmentedControlIOS = createReactClass({
|
||||||
displayName: 'SegmentedControlIOS',
|
displayName: 'SegmentedControlIOS',
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
|
@ -29,7 +29,6 @@ type Event = Object;
|
||||||
/**
|
/**
|
||||||
* A component used to select a single value from a range of values.
|
* A component used to select a single value from a range of values.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
var Slider = createReactClass({
|
var Slider = createReactClass({
|
||||||
displayName: 'Slider',
|
displayName: 'Slider',
|
||||||
mixins: [NativeMethodsMixin],
|
mixins: [NativeMethodsMixin],
|
||||||
|
|
|
@ -38,7 +38,6 @@ type DefaultProps = {
|
||||||
* @keyword checkbox
|
* @keyword checkbox
|
||||||
* @keyword toggle
|
* @keyword toggle
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
var Switch = createReactClass({
|
var Switch = createReactClass({
|
||||||
displayName: 'Switch',
|
displayName: 'Switch',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
|
|
@ -181,7 +181,6 @@ const DataDetectorTypes = [
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const TextInput = createReactClass({
|
const TextInput = createReactClass({
|
||||||
displayName: 'TextInput',
|
displayName: 'TextInput',
|
||||||
statics: {
|
statics: {
|
||||||
|
|
|
@ -36,7 +36,6 @@ var PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||||
* `TouchableMixin` expects us to implement some abstract methods to handle
|
* `TouchableMixin` expects us to implement some abstract methods to handle
|
||||||
* interesting interactions such as `handleTouchablePress`.
|
* interesting interactions such as `handleTouchablePress`.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
var TouchableBounce = createReactClass({
|
var TouchableBounce = createReactClass({
|
||||||
displayName: 'TouchableBounce',
|
displayName: 'TouchableBounce',
|
||||||
mixins: [Touchable.Mixin, NativeMethodsMixin],
|
mixins: [Touchable.Mixin, NativeMethodsMixin],
|
||||||
|
|
|
@ -102,7 +102,6 @@ const TouchableWithoutFeedback = createReactClass({
|
||||||
* reactivated! Move it back and forth several times while the scroll view
|
* reactivated! Move it back and forth several times while the scroll view
|
||||||
* is disabled. Ensure you pass in a constant to reduce memory allocations.
|
* is disabled. Ensure you pass in a constant to reduce memory allocations.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe: Expected a React PropType instead
|
|
||||||
pressRetentionOffset: EdgeInsetsPropType,
|
pressRetentionOffset: EdgeInsetsPropType,
|
||||||
/**
|
/**
|
||||||
* This defines how far your touch can start away from the button. This is
|
* This defines how far your touch can start away from the button. This is
|
||||||
|
@ -112,7 +111,6 @@ const TouchableWithoutFeedback = createReactClass({
|
||||||
* of sibling views always takes precedence if a touch hits two overlapping
|
* of sibling views always takes precedence if a touch hits two overlapping
|
||||||
* views.
|
* views.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe: Expected a React PropType instead
|
|
||||||
hitSlop: EdgeInsetsPropType,
|
hitSlop: EdgeInsetsPropType,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ export type Props = ViewProps;
|
||||||
* - `timestamp` - A time identifier for the touch, useful for velocity calculation.
|
* - `timestamp` - A time identifier for the touch, useful for velocity calculation.
|
||||||
* - `touches` - Array of all current touches on the screen.
|
* - `touches` - Array of all current touches on the screen.
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const View = createReactClass({
|
const View = createReactClass({
|
||||||
displayName: 'View',
|
displayName: 'View',
|
||||||
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,
|
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,
|
||||||
|
|
|
@ -132,7 +132,6 @@ const ImageViewManager = NativeModules.ImageViewManager;
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const Image = createReactClass({
|
const Image = createReactClass({
|
||||||
displayName: 'Image',
|
displayName: 'Image',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
|
|
@ -15,12 +15,12 @@ const PropTypes = require('prop-types');
|
||||||
|
|
||||||
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
||||||
|
|
||||||
const EdgeInsetsPropType = createStrictShapeTypeChecker({
|
const EdgeInsetsPropType = (createStrictShapeTypeChecker({
|
||||||
top: PropTypes.number,
|
top: PropTypes.number,
|
||||||
left: PropTypes.number,
|
left: PropTypes.number,
|
||||||
bottom: PropTypes.number,
|
bottom: PropTypes.number,
|
||||||
right: PropTypes.number,
|
right: PropTypes.number,
|
||||||
});
|
}): ReactPropsCheckType & ReactPropsChainableTypeChecker);
|
||||||
|
|
||||||
export type EdgeInsetsProp = {
|
export type EdgeInsetsProp = {
|
||||||
top: number,
|
top: number,
|
||||||
|
|
|
@ -285,7 +285,6 @@ const viewConfig = {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $FlowFixMe(>=0.41.0)
|
|
||||||
const Text = createReactClass({
|
const Text = createReactClass({
|
||||||
displayName: 'Text',
|
displayName: 'Text',
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
|
Loading…
Reference in New Issue