From c96ab50007d8b55ec564e81dfcd151050a5c095d Mon Sep 17 00:00:00 2001 From: danibonilha Date: Thu, 27 Sep 2018 00:14:46 -0300 Subject: [PATCH 1/2] Split EdgeInsets in DeprecatedPropTypes and flow types --- .../Components/Touchable/TouchableBounce.js | 2 +- .../Touchable/TouchableWithoutFeedback.js | 2 +- .../Components/WebView/WebView.android.js | 2 +- Libraries/Components/WebView/WebView.ios.js | 2 +- .../DeprecatedEdgeInsetsPropType.js | 22 +++++++++++++++++++ .../DeprecatedViewPropTypes.js | 2 +- Libraries/Image/ImageProps.js | 2 +- Libraries/StyleSheet/EdgeInsetsPropType.js | 11 ---------- Libraries/Text/TextPropTypes.js | 2 +- 9 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index 9b7147a318a4eb..ddd9acc6831717 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -11,7 +11,7 @@ const Animated = require('Animated'); const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const PropTypes = require('prop-types'); const React = require('React'); diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index b80d4336c6d92e..a664074f756b6f 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -10,7 +10,7 @@ 'use strict'; -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const React = require('React'); const PropTypes = require('prop-types'); const TimerMixin = require('react-timer-mixin'); diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index 4661ce89612d2a..aa2cadc6cbd2a5 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -11,7 +11,7 @@ const ActivityIndicator = require('ActivityIndicator'); const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const PropTypes = require('prop-types'); const React = require('React'); const ReactNative = require('ReactNative'); diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index 30b6cb3bedcccd..ef9b6d2d8bcc62 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -12,7 +12,7 @@ const ActivityIndicator = require('ActivityIndicator'); const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const Linking = require('Linking'); const PropTypes = require('prop-types'); const React = require('React'); diff --git a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js new file mode 100644 index 00000000000000..ab08342db242f0 --- /dev/null +++ b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js @@ -0,0 +1,22 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow strict + */ + +'use strict'; + +const PropTypes = require('prop-types'); + +const EdgeInsetsPropType = PropTypes.shape({ + top: PropTypes.number, + left: PropTypes.number, + bottom: PropTypes.number, + right: PropTypes.number, +}); + +module.exports = EdgeInsetsPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js index 9e22627d9147f3..dfa59782651e8a 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js @@ -10,7 +10,7 @@ 'use strict'; -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const PlatformViewPropTypes = require('PlatformViewPropTypes'); const PropTypes = require('prop-types'); const StyleSheetPropType = require('StyleSheetPropType'); diff --git a/Libraries/Image/ImageProps.js b/Libraries/Image/ImageProps.js index 8aabf9e4461a40..af0b865e288704 100644 --- a/Libraries/Image/ImageProps.js +++ b/Libraries/Image/ImageProps.js @@ -10,7 +10,7 @@ 'use strict'; -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const ImageSourcePropType = require('ImageSourcePropType'); const ImageStylePropTypes = require('ImageStylePropTypes'); const PropTypes = require('prop-types'); diff --git a/Libraries/StyleSheet/EdgeInsetsPropType.js b/Libraries/StyleSheet/EdgeInsetsPropType.js index 1b3124ece1eadc..779bca391da9d3 100644 --- a/Libraries/StyleSheet/EdgeInsetsPropType.js +++ b/Libraries/StyleSheet/EdgeInsetsPropType.js @@ -10,20 +10,9 @@ 'use strict'; -const PropTypes = require('prop-types'); - -const EdgeInsetsPropType = PropTypes.shape({ - top: PropTypes.number, - left: PropTypes.number, - bottom: PropTypes.number, - right: PropTypes.number, -}); - export type EdgeInsetsProp = $ReadOnly<{| top?: ?number, left?: ?number, bottom?: ?number, right?: ?number, |}>; - -module.exports = EdgeInsetsPropType; diff --git a/Libraries/Text/TextPropTypes.js b/Libraries/Text/TextPropTypes.js index 60620cf7c935c7..a5cd0d49d5b4fd 100644 --- a/Libraries/Text/TextPropTypes.js +++ b/Libraries/Text/TextPropTypes.js @@ -11,7 +11,7 @@ 'use strict'; const ColorPropType = require('ColorPropType'); -const EdgeInsetsPropType = require('EdgeInsetsPropType'); +const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const PropTypes = require('prop-types'); const StyleSheetPropType = require('StyleSheetPropType'); const TextStylePropTypes = require('TextStylePropTypes'); From e5902736580cd7a0da6640080657b9c791944c89 Mon Sep 17 00:00:00 2001 From: danibonilha Date: Thu, 27 Sep 2018 01:44:33 -0300 Subject: [PATCH 2/2] Update EdgeInsetsPropType references to DeprecatedEdgeInsetsPropType --- Libraries/Components/Touchable/TouchableBounce.js | 4 ++-- Libraries/Components/Touchable/TouchableWithoutFeedback.js | 6 +++--- Libraries/Components/WebView/WebView.android.js | 4 ++-- Libraries/Components/WebView/WebView.ios.js | 4 ++-- .../DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js | 4 ++-- Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js | 4 ++-- Libraries/Image/ImageProps.js | 4 ++-- Libraries/Text/TextPropTypes.js | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index ddd9acc6831717..c1e3a731fec294 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -11,7 +11,7 @@ const Animated = require('Animated'); const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const PropTypes = require('prop-types'); const React = require('React'); @@ -70,7 +70,7 @@ const TouchableBounce = ((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. */ - pressRetentionOffset: EdgeInsetsPropType, + pressRetentionOffset: DeprecatedEdgeInsetsPropType, releaseVelocity: PropTypes.number.isRequired, releaseBounciness: PropTypes.number.isRequired, /** diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index a664074f756b6f..0b1dc3843c65a7 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -10,7 +10,7 @@ 'use strict'; -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const React = require('React'); const PropTypes = require('prop-types'); const TimerMixin = require('react-timer-mixin'); @@ -154,7 +154,7 @@ 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. */ - pressRetentionOffset: EdgeInsetsPropType, + pressRetentionOffset: DeprecatedEdgeInsetsPropType, /** * This defines how far your touch can start away from the button. This is * added to `pressRetentionOffset` when moving off of the button. @@ -163,7 +163,7 @@ const TouchableWithoutFeedback = ((createReactClass({ * of sibling views always takes precedence if a touch hits two overlapping * views. */ - hitSlop: EdgeInsetsPropType, + hitSlop: DeprecatedEdgeInsetsPropType, }, getInitialState: function() { diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index aa2cadc6cbd2a5..6c85f0f642c69f 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -11,7 +11,7 @@ const ActivityIndicator = require('ActivityIndicator'); const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const PropTypes = require('prop-types'); const React = require('React'); const ReactNative = require('ReactNative'); @@ -52,7 +52,7 @@ class WebView extends React.Component { onLoadStart: PropTypes.func, onError: PropTypes.func, automaticallyAdjustContentInsets: PropTypes.bool, - contentInset: EdgeInsetsPropType, + contentInset: DeprecatedEdgeInsetsPropType, onNavigationStateChange: PropTypes.func, onMessage: PropTypes.func, onContentSizeChange: PropTypes.func, diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index ef9b6d2d8bcc62..290db85eb80cd6 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -12,7 +12,7 @@ const ActivityIndicator = require('ActivityIndicator'); const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const Linking = require('Linking'); const PropTypes = require('prop-types'); const React = require('React'); @@ -234,7 +234,7 @@ class WebView extends React.Component { * the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}. * @platform ios */ - contentInset: EdgeInsetsPropType, + contentInset: DeprecatedEdgeInsetsPropType, /** * Function that is invoked when the `WebView` loading starts or ends. */ diff --git a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js index ab08342db242f0..67a016fffc8d24 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js @@ -12,11 +12,11 @@ const PropTypes = require('prop-types'); -const EdgeInsetsPropType = PropTypes.shape({ +const DeprecatedEdgeInsetsPropType = PropTypes.shape({ top: PropTypes.number, left: PropTypes.number, bottom: PropTypes.number, right: PropTypes.number, }); -module.exports = EdgeInsetsPropType; +module.exports = DeprecatedEdgeInsetsPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js index dfa59782651e8a..99c51ff5dedb55 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js @@ -10,7 +10,7 @@ 'use strict'; -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const PlatformViewPropTypes = require('PlatformViewPropTypes'); const PropTypes = require('prop-types'); const StyleSheetPropType = require('StyleSheetPropType'); @@ -316,7 +316,7 @@ module.exports = { * * See http://facebook.github.io/react-native/docs/view.html#hitslop */ - hitSlop: EdgeInsetsPropType, + hitSlop: DeprecatedEdgeInsetsPropType, /** * Invoked on mount and layout changes with: diff --git a/Libraries/Image/ImageProps.js b/Libraries/Image/ImageProps.js index af0b865e288704..b0b96423629bc2 100644 --- a/Libraries/Image/ImageProps.js +++ b/Libraries/Image/ImageProps.js @@ -10,7 +10,7 @@ 'use strict'; -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const ImageSourcePropType = require('ImageSourcePropType'); const ImageStylePropTypes = require('ImageStylePropTypes'); const PropTypes = require('prop-types'); @@ -121,7 +121,7 @@ module.exports = { /** * See https://facebook.github.io/react-native/docs/image.html#capinsets */ - capInsets: EdgeInsetsPropType, + capInsets: DeprecatedEdgeInsetsPropType, /** * See https://facebook.github.io/react-native/docs/image.html#resizemethod */ diff --git a/Libraries/Text/TextPropTypes.js b/Libraries/Text/TextPropTypes.js index a5cd0d49d5b4fd..a8e3017acb5f16 100644 --- a/Libraries/Text/TextPropTypes.js +++ b/Libraries/Text/TextPropTypes.js @@ -11,7 +11,7 @@ 'use strict'; const ColorPropType = require('ColorPropType'); -const EdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); +const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType'); const PropTypes = require('prop-types'); const StyleSheetPropType = require('StyleSheetPropType'); const TextStylePropTypes = require('TextStylePropTypes'); @@ -62,7 +62,7 @@ module.exports = { * * See https://facebook.github.io/react-native/docs/text.html#pressretentionoffset */ - pressRetentionOffset: EdgeInsetsPropType, + pressRetentionOffset: DeprecatedEdgeInsetsPropType, /** * Lets the user select text. *