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:
ashoat 2017-10-20 03:42:20 -07:00 committed by Facebook Github Bot
parent 7e0b7ef8d0
commit 833b27483b
16 changed files with 2 additions and 20 deletions

View File

@ -78,9 +78,6 @@ type DefaultProps = {
* 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({
displayName: 'ActivityIndicator',
mixins: [NativeMethodsMixin],

View File

@ -37,7 +37,6 @@ type DefaultProps = {
* @keyword checkbox
* @keyword toggle
*/
// $FlowFixMe(>=0.41.0)
let CheckBox = createReactClass({
displayName: 'CheckBox',
propTypes: {

View File

@ -36,7 +36,6 @@ type Event = Object;
* the user's change will be reverted immediately to reflect `props.date` as the
* source of truth.
*/
// $FlowFixMe(>=0.41.0)
const DatePickerIOS = createReactClass({
displayName: 'DatePickerIOS',
// TOOD: Put a better type for _picker

View File

@ -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 can automatically adjust either its position or bottom padding based on the position of the keyboard.
*/
// $FlowFixMe(>=0.41.0)
const KeyboardAvoidingView = createReactClass({
displayName: 'KeyboardAvoidingView',
mixins: [TimerMixin],

View File

@ -24,7 +24,6 @@ var requireNativeComponent = require('requireNativeComponent');
/**
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
*/
// $FlowFixMe(>=0.41.0)
var ProgressViewIOS = createReactClass({
displayName: 'ProgressViewIOS',
mixins: [NativeMethodsMixin],

View File

@ -72,7 +72,6 @@ if (Platform.OS === 'android') {
* __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.
*/
// $FlowFixMe(>=0.41.0)
const RefreshControl = createReactClass({
displayName: 'RefreshControl',
statics: {

View File

@ -49,7 +49,6 @@ type Event = Object;
* />
* ````
*/
// $FlowFixMe(>=0.41.0)
var SegmentedControlIOS = createReactClass({
displayName: 'SegmentedControlIOS',
mixins: [NativeMethodsMixin],

View File

@ -29,7 +29,6 @@ type Event = Object;
/**
* A component used to select a single value from a range of values.
*/
// $FlowFixMe(>=0.41.0)
var Slider = createReactClass({
displayName: 'Slider',
mixins: [NativeMethodsMixin],

View File

@ -38,7 +38,6 @@ type DefaultProps = {
* @keyword checkbox
* @keyword toggle
*/
// $FlowFixMe(>=0.41.0)
var Switch = createReactClass({
displayName: 'Switch',
propTypes: {

View File

@ -181,7 +181,6 @@ const DataDetectorTypes = [
*
*/
// $FlowFixMe(>=0.41.0)
const TextInput = createReactClass({
displayName: 'TextInput',
statics: {

View File

@ -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
* interesting interactions such as `handleTouchablePress`.
*/
// $FlowFixMe(>=0.41.0)
var TouchableBounce = createReactClass({
displayName: 'TouchableBounce',
mixins: [Touchable.Mixin, NativeMethodsMixin],

View File

@ -102,7 +102,6 @@ const TouchableWithoutFeedback = createReactClass({
* reactivated! Move it back and forth several times while the scroll view
* is disabled. Ensure you pass in a constant to reduce memory allocations.
*/
// $FlowFixMe: Expected a React PropType instead
pressRetentionOffset: EdgeInsetsPropType,
/**
* 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
* views.
*/
// $FlowFixMe: Expected a React PropType instead
hitSlop: EdgeInsetsPropType,
},

View File

@ -73,7 +73,6 @@ export type Props = ViewProps;
* - `timestamp` - A time identifier for the touch, useful for velocity calculation.
* - `touches` - Array of all current touches on the screen.
*/
// $FlowFixMe(>=0.41.0)
const View = createReactClass({
displayName: 'View',
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,

View File

@ -132,7 +132,6 @@ const ImageViewManager = NativeModules.ImageViewManager;
* ```
*
*/
// $FlowFixMe(>=0.41.0)
const Image = createReactClass({
displayName: 'Image',
propTypes: {

View File

@ -15,12 +15,12 @@ const PropTypes = require('prop-types');
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
const EdgeInsetsPropType = createStrictShapeTypeChecker({
const EdgeInsetsPropType = (createStrictShapeTypeChecker({
top: PropTypes.number,
left: PropTypes.number,
bottom: PropTypes.number,
right: PropTypes.number,
});
}): ReactPropsCheckType & ReactPropsChainableTypeChecker);
export type EdgeInsetsProp = {
top: number,

View File

@ -285,7 +285,6 @@ const viewConfig = {
*
*/
// $FlowFixMe(>=0.41.0)
const Text = createReactClass({
displayName: 'Text',
propTypes: {