Skip to content

Commit

Permalink
Move and Rename custom propType definitions in LayoutPropTypes (faceb…
Browse files Browse the repository at this point in the history
…ook#21370)

Summary:
related facebook#21342

TODO
* move LayoutPropType.js
* fix flow error

CheckList
 - [x] `yarn prettier`
 - [x] `yarn flow-check-android`
 - [x] `yarn flow-check-ios`

All flow checks pass.

[GENERAL] [ENHANCEMENT] [DeprecatedLayoutPropTypes.js] - Created.
[GENERAL] [ENHANCEMENT] [StyleSheetTypes.js] - add comments.
Pull Request resolved: facebook#21370

Differential Revision: D10099715

Pulled By: RSNara

fbshipit-source-id: d0515fe0d56d9ed2fde50cc0bfb75b63aded1f5d
  • Loading branch information
nissy-dev authored and facebook-github-bot committed Oct 1, 2018
1 parent d6f3d37 commit b6b0fc1
Show file tree
Hide file tree
Showing 5 changed files with 566 additions and 566 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
'use strict';

const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedLayoutPropTypes = require('DeprecatedLayoutPropTypes');
const ReactPropTypes = require('prop-types');
const DeprecatedShadowPropTypesIOS = require('DeprecatedShadowPropTypesIOS');
const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');

const ImageStylePropTypes = {
...LayoutPropTypes,
...DeprecatedLayoutPropTypes,
...DeprecatedShadowPropTypesIOS,
...DeprecatedTransformPropTypes,
resizeMode: ReactPropTypes.oneOf([
Expand Down
190 changes: 190 additions & 0 deletions Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/**
* 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 ReactPropTypes = require('prop-types');

const LayoutPropTypes = {
display: ReactPropTypes.oneOf(['none', 'flex']),
width: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
height: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
start: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
end: ReactPropTypes.oneOfType([ReactPropTypes.number, ReactPropTypes.string]),
top: ReactPropTypes.oneOfType([ReactPropTypes.number, ReactPropTypes.string]),
left: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
right: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
bottom: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
minWidth: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
maxWidth: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
minHeight: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
maxHeight: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
margin: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginVertical: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginHorizontal: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginTop: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginBottom: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginLeft: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginRight: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginStart: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
marginEnd: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
padding: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingVertical: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingHorizontal: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingTop: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingBottom: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingLeft: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingRight: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingStart: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
paddingEnd: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
borderWidth: ReactPropTypes.number,
borderTopWidth: ReactPropTypes.number,
borderStartWidth: ReactPropTypes.number,
borderEndWidth: ReactPropTypes.number,
borderRightWidth: ReactPropTypes.number,
borderBottomWidth: ReactPropTypes.number,
borderLeftWidth: ReactPropTypes.number,
position: ReactPropTypes.oneOf(['absolute', 'relative']),
flexDirection: ReactPropTypes.oneOf([
'row',
'row-reverse',
'column',
'column-reverse',
]),
flexWrap: ReactPropTypes.oneOf(['wrap', 'nowrap', 'wrap-reverse']),
justifyContent: ReactPropTypes.oneOf([
'flex-start',
'flex-end',
'center',
'space-between',
'space-around',
'space-evenly',
]),
alignItems: ReactPropTypes.oneOf([
'flex-start',
'flex-end',
'center',
'stretch',
'baseline',
]),
alignSelf: ReactPropTypes.oneOf([
'auto',
'flex-start',
'flex-end',
'center',
'stretch',
'baseline',
]),
alignContent: ReactPropTypes.oneOf([
'flex-start',
'flex-end',
'center',
'stretch',
'space-between',
'space-around',
]),
overflow: ReactPropTypes.oneOf(['visible', 'hidden', 'scroll']),
flex: ReactPropTypes.number,
flexGrow: ReactPropTypes.number,
flexShrink: ReactPropTypes.number,
flexBasis: ReactPropTypes.oneOfType([
ReactPropTypes.number,
ReactPropTypes.string,
]),
aspectRatio: ReactPropTypes.number,
zIndex: ReactPropTypes.number,
direction: ReactPropTypes.oneOf(['inherit', 'ltr', 'rtl']),
};

module.exports = LayoutPropTypes;
4 changes: 2 additions & 2 deletions Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'use strict';

const DeprecatedColorPropType = require('DeprecatedColorPropType');
const LayoutPropTypes = require('LayoutPropTypes');
const DeprecatedLayoutPropTypes = require('DeprecatedLayoutPropTypes');
const ReactPropTypes = require('prop-types');
const DeprecatedShadowPropTypesIOS = require('DeprecatedShadowPropTypesIOS');
const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');
Expand All @@ -20,7 +20,7 @@ const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');
* Warning: Some of these properties may not be supported in all releases.
*/
const DeprecatedViewStylePropTypes = {
...LayoutPropTypes,
...DeprecatedLayoutPropTypes,
...DeprecatedShadowPropTypesIOS,
...DeprecatedTransformPropTypes,
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
Expand Down
Loading

0 comments on commit b6b0fc1

Please sign in to comment.