Skip to content

Commit

Permalink
Move and Rename custom propType definitions in ColorPropTypes (facebo…
Browse files Browse the repository at this point in the history
…ok#21371)

Summary:
related facebook#21342

TODO
* move ColorPropType.js
* fix flow error

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

All flow checks pass.

[GENERAL] [ENHANCEMENT] [DeprecatedColorPropType.js] - Created.
Pull Request resolved: facebook#21371

Reviewed By: RSNara

Differential Revision: D10087818

Pulled By: TheSavior

fbshipit-source-id: 48088b441699886eef1fff3aafc2ca6015455006
  • Loading branch information
nissy-dev authored and facebook-github-bot committed Sep 28, 2018
1 parent bc7646d commit 0be76c5
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 42 deletions.
1 change: 0 additions & 1 deletion Libraries/Components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';

const ColorPropType = require('ColorPropType');
const Platform = require('Platform');
const React = require('React');
const StyleSheet = require('StyleSheet');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
Expand Down Expand Up @@ -92,7 +92,7 @@ const DrawerLayoutAndroid = createReactClass({
* );
* ```
*/
drawerBackgroundColor: ColorPropType,
drawerBackgroundColor: DeprecatedColorPropType,
/**
* Specifies the side of the screen from which the drawer will slide in.
*/
Expand Down Expand Up @@ -147,7 +147,7 @@ const DrawerLayoutAndroid = createReactClass({
* status bar to allow it to open over the status bar. It will only have an
* effect on API 21+.
*/
statusBarBackgroundColor: ColorPropType,
statusBarBackgroundColor: DeprecatedColorPropType,
},

mixins: [NativeMethodsMixin],
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/TextInput/InputAccessoryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const Platform = require('Platform');
const React = require('React');
Expand Down Expand Up @@ -85,7 +85,7 @@ type Props = {
*/
nativeID?: string,
style?: DeprecatedViewPropTypes.style,
backgroundColor?: ColorPropType,
backgroundColor?: DeprecatedColorPropType,
};

class InputAccessoryView extends React.Component<Props> {
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const DocumentSelectionState = require('DocumentSelectionState');
const EventEmitter = require('EventEmitter');
Expand Down Expand Up @@ -592,7 +592,7 @@ const TextInput = createReactClass({
/**
* The text color of the placeholder string.
*/
placeholderTextColor: ColorPropType,
placeholderTextColor: DeprecatedColorPropType,
/**
* If `false`, scrolling of the text view will be disabled.
* The default value is `true`. Does only work with 'multiline={true}'.
Expand All @@ -607,7 +607,7 @@ const TextInput = createReactClass({
/**
* The highlight and cursor color of the text input.
*/
selectionColor: ColorPropType,
selectionColor: DeprecatedColorPropType,
/**
* An instance of `DocumentSelectionState`, this is some state that is responsible for
* maintaining selection information for a document.
Expand Down Expand Up @@ -698,7 +698,7 @@ const TextInput = createReactClass({
* The color of the `TextInput` underline.
* @platform android
*/
underlineColorAndroid: ColorPropType,
underlineColorAndroid: DeprecatedColorPropType,

/**
* If defined, the provided image resource will be rendered on the left.
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const Image = require('Image');
const NativeMethodsMixin = require('NativeMethodsMixin');
Expand Down Expand Up @@ -118,15 +118,15 @@ const ToolbarAndroid = createReactClass({
/**
* Sets the toolbar subtitle color.
*/
subtitleColor: ColorPropType,
subtitleColor: DeprecatedColorPropType,
/**
* Sets the toolbar title.
*/
title: PropTypes.string,
/**
* Sets the toolbar title color.
*/
titleColor: ColorPropType,
titleColor: DeprecatedColorPropType,
/**
* Sets the content inset for the toolbar starting edge.
*
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
Expand Down Expand Up @@ -164,7 +164,7 @@ const TouchableHighlight = ((createReactClass({
* The color of the underlay that will show through when the touch is
* active.
*/
underlayColor: ColorPropType,
underlayColor: DeprecatedColorPropType,
/**
* Style to apply to the container/underlay. Most commonly used to make sure
* rounded corners match the wrapped component.
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Components/View/ShadowPropTypesIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const ReactPropTypes = require('prop-types');

/**
Expand All @@ -26,7 +26,7 @@ const ShadowPropTypesIOS = {
* Sets the drop shadow color
* @platform ios
*/
shadowColor: ColorPropType,
shadowColor: DeprecatedColorPropType,
/**
* Sets the drop shadow offset
* @platform ios
Expand Down
18 changes: 9 additions & 9 deletions Libraries/Components/View/ViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
const ShadowPropTypesIOS = require('ShadowPropTypesIOS');
Expand All @@ -24,14 +24,14 @@ const ViewStylePropTypes = {
...ShadowPropTypesIOS,
...DeprecatedTransformPropTypes,
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: ColorPropType,
borderColor: ColorPropType,
borderTopColor: ColorPropType,
borderRightColor: ColorPropType,
borderBottomColor: ColorPropType,
borderLeftColor: ColorPropType,
borderStartColor: ColorPropType,
borderEndColor: ColorPropType,
backgroundColor: DeprecatedColorPropType,
borderColor: DeprecatedColorPropType,
borderTopColor: DeprecatedColorPropType,
borderRightColor: DeprecatedColorPropType,
borderBottomColor: DeprecatedColorPropType,
borderLeftColor: DeprecatedColorPropType,
borderStartColor: DeprecatedColorPropType,
borderEndColor: DeprecatedColorPropType,
borderRadius: ReactPropTypes.number,
borderTopLeftRadius: ReactPropTypes.number,
borderTopRightRadius: ReactPropTypes.number,
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions Libraries/Image/ImageStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const ImageResizeMode = require('ImageResizeMode');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
Expand All @@ -22,16 +22,16 @@ const ImageStylePropTypes = {
...DeprecatedTransformPropTypes,
resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode)),
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: ColorPropType,
borderColor: ColorPropType,
backgroundColor: DeprecatedColorPropType,
borderColor: DeprecatedColorPropType,
borderWidth: ReactPropTypes.number,
borderRadius: ReactPropTypes.number,
overflow: ReactPropTypes.oneOf(['visible', 'hidden']),

/**
* Changes the color of all the non-transparent pixels to the tintColor.
*/
tintColor: ColorPropType,
tintColor: DeprecatedColorPropType,
opacity: ReactPropTypes.number,
/**
* When the image has rounded corners, specifying an overlayColor will
Expand Down
6 changes: 2 additions & 4 deletions Libraries/Inspector/ElementProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Props = $ReadOnly<{|
},
frame?: ?Object,
selection?: ?number,
setSelection?: (number) => mixed,
setSelection?: number => mixed,
|}>;

class ElementProperties extends React.Component<Props> {
Expand Down Expand Up @@ -86,9 +86,7 @@ class ElementProperties extends React.Component<Props> {
<StyleInspector style={style} />
{openFileButton}
</View>
{
<BoxInspector style={style} frame={this.props.frame} />
}
{<BoxInspector style={style} frame={this.props.frame} />}
</View>
</View>
</TouchableWithoutFeedback>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/XMLHttpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class XMLHttpRequest extends EventTarget(...XHR_EVENTS) {
this._cachedResponse = BlobManager.createFromOptions(this._response);
} else if (this._response === '') {
this._cachedResponse = null;
} else {
} else {
throw new Error(`Invalid response for blob: ${this._response}`);
}
break;
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Text/TextPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedEdgeInsetsPropType = require('DeprecatedEdgeInsetsPropType');
const PropTypes = require('prop-types');
const StyleSheetPropType = require('StyleSheetPropType');
Expand Down Expand Up @@ -74,7 +74,7 @@ module.exports = {
*
* See https://facebook.github.io/react-native/docs/text.html#selectioncolor
*/
selectionColor: ColorPropType,
selectionColor: DeprecatedColorPropType,
/**
* When `true`, no visual change is made when text is pressed down.
*
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Text/TextStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

'use strict';

const ColorPropType = require('ColorPropType');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const ReactPropTypes = require('prop-types');
const ViewStylePropTypes = require('ViewStylePropTypes');

const TextStylePropTypes = {
...ViewStylePropTypes,

color: ColorPropType,
color: DeprecatedColorPropType,
fontFamily: ReactPropTypes.string,
fontSize: ReactPropTypes.number,
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
Expand Down Expand Up @@ -56,7 +56,7 @@ const TextStylePropTypes = {
height: ReactPropTypes.number,
}),
textShadowRadius: ReactPropTypes.number,
textShadowColor: ColorPropType,
textShadowColor: DeprecatedColorPropType,
/**
* @platform ios
*/
Expand Down Expand Up @@ -107,7 +107,7 @@ const TextStylePropTypes = {
/**
* @platform ios
*/
textDecorationColor: ColorPropType,
textDecorationColor: DeprecatedColorPropType,
textTransform: ReactPropTypes.oneOf([
'none' /*default*/,
'capitalize',
Expand Down
2 changes: 1 addition & 1 deletion Libraries/react-native/react-native-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ const ReactNative = {

// Prop Types
get ColorPropType() {
return require('ColorPropType');
return require('DeprecatedColorPropType');
},
get EdgeInsetsPropType() {
return require('DeprecatedEdgeInsetsPropType');
Expand Down

0 comments on commit 0be76c5

Please # to comment.