Split EdgeInsets in DeprecatedPropTypes and flow types (#21351)

Summary:
This PR splits EdgeInsetsPropTypes into EdgeInsetsPropTypes with only flow types and DeprecatedEdgeInsetsPropTypes inside DeprecatedProptypes with only PropTypes.

Related to #21342
Pull Request resolved: https://github.com/facebook/react-native/pull/21351

Reviewed By: RSNara

Differential Revision: D10081512

Pulled By: TheSavior

fbshipit-source-id: 267a6fbb455e02dd7f2b0f3b59790e96387eaa09
This commit is contained in:
danibonilha
2018-09-27 10:51:15 -07:00
committed by Facebook Github Bot
parent b3bf7e0cf9
commit f68b0c9d79
10 changed files with 38 additions and 27 deletions

View File

@@ -11,7 +11,7 @@
const Animated = require('Animated');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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,
/**

View File

@@ -10,7 +10,7 @@
'use strict';
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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() {

View File

@@ -11,7 +11,7 @@
const ActivityIndicator = require('ActivityIndicator');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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,

View File

@@ -12,7 +12,7 @@
const ActivityIndicator = require('ActivityIndicator');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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.
*/

View File

@@ -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 DeprecatedEdgeInsetsPropType = PropTypes.shape({
top: PropTypes.number,
left: PropTypes.number,
bottom: PropTypes.number,
right: PropTypes.number,
});
module.exports = DeprecatedEdgeInsetsPropType;

View File

@@ -10,7 +10,7 @@
'use strict';
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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:

View File

@@ -10,7 +10,7 @@
'use strict';
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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
*/

View File

@@ -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;

View File

@@ -11,7 +11,7 @@
'use strict';
const ColorPropType = require('ColorPropType');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
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.
*

View File

@@ -304,7 +304,7 @@ const ReactNative = {
return require('ColorPropType');
},
get EdgeInsetsPropType() {
return require('EdgeInsetsPropType');
return require('DeprecatedEdgeInsetsPropType');
},
get PointPropType() {
return require('DeprecatedPointPropType');