From a9cdffe2dea7cce6dba6b96a3d0825063ad2eebe Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Wed, 14 Aug 2019 15:40:42 -0700 Subject: [PATCH 01/13] add normalize/processColorObject.js for ios and macos --- Libraries/Color/normalizeColor.js | 38 +++++-------------- Libraries/Color/normalizeColorObject.ios.js | 31 +++++++++++++++ Libraries/Color/normalizeColorObject.js | 9 +++++ Libraries/Color/normalizeColorObject.macos.js | 31 +++++++++++++++ .../ActivityIndicator/ActivityIndicator.js | 4 +- ...RCTActivityIndicatorViewNativeComponent.js | 4 +- .../AndroidDrawerLayoutNativeComponent.js | 4 +- Libraries/Components/Picker/PickerIOS.ios.js | 4 +- .../Picker/RCTPickerNativeComponent.js | 4 +- .../Switch/SwitchNativeComponent.js | 12 +++--- .../ToolbarAndroidNativeComponent.js | 4 +- .../TouchableNativeFeedback.android.js | 4 +- .../getNativeComponentAttributes.js | 4 +- Libraries/StyleSheet/StyleSheetTypes.js | 4 +- Libraries/StyleSheet/processColor.js | 29 +++++--------- .../StyleSheet/processColorObject.ios.js | 20 ++++++++++ Libraries/StyleSheet/processColorObject.js | 7 ++++ .../StyleSheet/processColorObject.macos.js | 20 ++++++++++ 18 files changed, 162 insertions(+), 71 deletions(-) create mode 100644 Libraries/Color/normalizeColorObject.ios.js create mode 100644 Libraries/Color/normalizeColorObject.js create mode 100644 Libraries/Color/normalizeColorObject.macos.js create mode 100644 Libraries/StyleSheet/processColorObject.ios.js create mode 100644 Libraries/StyleSheet/processColorObject.js create mode 100644 Libraries/StyleSheet/processColorObject.macos.js diff --git a/Libraries/Color/normalizeColor.js b/Libraries/Color/normalizeColor.js index d3985cd12c6c01..cffe6ae3898fa1 100755 --- a/Libraries/Color/normalizeColor.js +++ b/Libraries/Color/normalizeColor.js @@ -11,23 +11,18 @@ /* eslint no-bitwise: 0 */ 'use strict'; -const Platform = require('Platform'); // [TODO(macOS ISS#2323203) +const normalizeColorObject = require('normalizeColorObject'); +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; -export type SemanticOrDynamicColorType = { - semantic?: string, - dynamic?: { - light: ?(string | number | SemanticOrDynamicColorType), - dark: ?(string | number | SemanticOrDynamicColorType), - }, -}; // ]TODO(macOS ISS#2323203) +export {NativeOrDynamicColorType} from 'normalizeColorObject'; function normalizeColor( color: ?( | string | number - | SemanticOrDynamicColorType + | NativeOrDynamicColorType ) /* TODO(macOS ISS#2323203) */, -): ?(number | SemanticOrDynamicColorType) /* TODO(macOS ISS#2323203) */ { +): ?(number | NativeOrDynamicColorType) /* TODO(macOS ISS#2323203) */ { const matchers = getMatchers(); let match; @@ -38,27 +33,14 @@ function normalizeColor( return null; } - // [TODO(macOS ISS#2323203) - if ( - typeof color === 'object' && - color !== null && - (Platform.OS === 'macos' || Platform.OS === 'ios') - ) { - if ('semantic' in color) { - // a macos semantic color + if (typeof color === 'object' && color !== null) { + const normalizedColorObj = normalizeColorObject(color); + + if (normalizedColorObj !== null) { return color; - } else if ('dynamic' in color && color.dynamic !== undefined) { - // a dynamic, appearance aware color - const dynamic = color.dynamic; - const dynamicColor: SemanticOrDynamicColorType = { - dynamic: { - light: normalizeColor(dynamic.light), - dark: normalizeColor(dynamic.dark), - }, - }; - return dynamicColor; } } + if (typeof color !== 'string') { return null; } // ]TODO(macOS ISS#2323203) diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js new file mode 100644 index 00000000000000..e44a2350ab8661 --- /dev/null +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -0,0 +1,31 @@ +const normalizeColor = require('normalizeColor'); + +export type NativeOrDynamicColorType = { + semantic?: string, + dynamic?: { + light: ?(string | number | NativeOrDynamicColorType), + dark: ?(string | number | NativeOrDynamicColorType), + }, +}; + +function normalizeColorObject( + color: ? NativeOrDynamicColorType, + ): ?(number | NativeOrDynamicColorType) { + + if ('semantic' in color) { + // a macos semantic color + return color; + } else if ('dynamic' in color && color.dynamic !== undefined) { + // a dynamic, appearance aware color + const dynamic = color.dynamic; + const dynamicColor: NativeColorType = { + dynamic: { + light: normalizeColor(dynamic.light), + dark: normalizeColor(dynamic.dark), + }, + }; + return dynamicColor; + } +} + +module.exports = normalizeColorObject; diff --git a/Libraries/Color/normalizeColorObject.js b/Libraries/Color/normalizeColorObject.js new file mode 100644 index 00000000000000..fc5eec3345bbaa --- /dev/null +++ b/Libraries/Color/normalizeColorObject.js @@ -0,0 +1,9 @@ +export type NativeOrDynamicColorType = { }; + +function normalizeColorObject( + color: ? NativeOrDynamicColorType, + ): ?(number | NativeOrDynamicColorType) { + return null; +} + +module.exports = normalizeColorObject; diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js new file mode 100644 index 00000000000000..e44a2350ab8661 --- /dev/null +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -0,0 +1,31 @@ +const normalizeColor = require('normalizeColor'); + +export type NativeOrDynamicColorType = { + semantic?: string, + dynamic?: { + light: ?(string | number | NativeOrDynamicColorType), + dark: ?(string | number | NativeOrDynamicColorType), + }, +}; + +function normalizeColorObject( + color: ? NativeOrDynamicColorType, + ): ?(number | NativeOrDynamicColorType) { + + if ('semantic' in color) { + // a macos semantic color + return color; + } else if ('dynamic' in color && color.dynamic !== undefined) { + // a dynamic, appearance aware color + const dynamic = color.dynamic; + const dynamicColor: NativeColorType = { + dynamic: { + light: normalizeColor(dynamic.light), + dark: normalizeColor(dynamic.dark), + }, + }; + return dynamicColor; + } +} + +module.exports = normalizeColorObject; diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 241f17392837ef..13965d6a22cbe6 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -19,7 +19,7 @@ const RCTActivityIndicatorViewNativeComponent = require('RCTActivityIndicatorVie import type {NativeComponent} from 'ReactNative'; import type {ViewProps} from 'ViewPropTypes'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) const RCTActivityIndicator = Platform.OS === 'android' @@ -54,7 +54,7 @@ type Props = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html#color */ - color?: ?(string | SemanticOrDynamicColorType), // ]TODO(macOS ISS#2323203) + color?: ?(string | NativeOrDynamicColorType), // ]TODO(macOS ISS#2323203) /** * Size of the indicator (default is 'small'). diff --git a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js index b0b8418515422f..9141642be475f3 100644 --- a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js +++ b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js @@ -15,7 +15,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; import type {ViewStyleProp} from 'StyleSheet'; import type {NativeComponent} from 'ReactNative'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) type NativeProps = $ReadOnly<{| ...ViewProps, @@ -39,7 +39,7 @@ type NativeProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html#color */ - color?: ?(string | SemanticOrDynamicColorType), + color?: ?(string | NativeOrDynamicColorType), /** * Size of the indicator (default is 'small'). diff --git a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js index 7839a940fd1bdd..47f002aa49e68e 100644 --- a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +++ b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js @@ -16,9 +16,9 @@ import type {NativeComponent} from 'ReactNative'; import type {SyntheticEvent} from 'CoreEventTypes'; import type {ViewStyleProp} from 'StyleSheet'; import type React from 'React'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) -type ColorValue = null | string | SemanticOrDynamicColorType; +type ColorValue = null | string | NativeOrDynamicColorType; type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index 9b446efe4381f2..ced72dbb37442a 100644 --- a/Libraries/Components/Picker/PickerIOS.ios.js +++ b/Libraries/Components/Picker/PickerIOS.ios.js @@ -24,7 +24,7 @@ import type {SyntheticEvent} from 'CoreEventTypes'; import type {ColorValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; import type {TextStyleProp} from 'StyleSheet'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| @@ -36,7 +36,7 @@ type PickerIOSChangeEvent = SyntheticEvent< type RCTPickerIOSItemType = $ReadOnly<{| label: ?Label, value: ?(number | string), - textColor: ?(number | SemanticOrDynamicColorType), // ]TODO(macOS ISS#2323203) + textColor: ?(number | NativeOrDynamicColorType), // ]TODO(macOS ISS#2323203) |}>; type RCTPickerIOSType = Class< diff --git a/Libraries/Components/Picker/RCTPickerNativeComponent.js b/Libraries/Components/Picker/RCTPickerNativeComponent.js index 2196128b10d60b..feb00ba17241c5 100644 --- a/Libraries/Components/Picker/RCTPickerNativeComponent.js +++ b/Libraries/Components/Picker/RCTPickerNativeComponent.js @@ -14,7 +14,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {SyntheticEvent} from 'CoreEventTypes'; import type {TextStyleProp} from 'StyleSheet'; import type {NativeComponent} from 'ReactNative'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| @@ -26,7 +26,7 @@ type PickerIOSChangeEvent = SyntheticEvent< type RCTPickerIOSItemType = $ReadOnly<{| label: ?Label, value: ?(number | string), - textColor: ?(number | SemanticOrDynamicColorType), + textColor: ?(number | NativeOrDynamicColorType), |}>; type Label = Stringish | number; diff --git a/Libraries/Components/Switch/SwitchNativeComponent.js b/Libraries/Components/Switch/SwitchNativeComponent.js index a28785817f91fc..3d85ed6905a23e 100644 --- a/Libraries/Components/Switch/SwitchNativeComponent.js +++ b/Libraries/Components/Switch/SwitchNativeComponent.js @@ -17,7 +17,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {SwitchChangeEvent} from 'CoreEventTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // TODO(macOS ISS#2323203) type SwitchProps = $ReadOnly<{| ...ViewProps, @@ -35,17 +35,17 @@ export type NativeAndroidProps = $ReadOnly<{| enabled?: ?boolean, on?: ?boolean, - thumbTintColor?: ?(string | SemanticOrDynamicColorType), - trackTintColor?: ?(string | SemanticOrDynamicColorType), + thumbTintColor?: ?(string | NativeOrDynamicColorType), + trackTintColor?: ?(string | NativeOrDynamicColorType), |}>; // @see RCTSwitchManager.m export type NativeIOSProps = $ReadOnly<{| ...SwitchProps, - onTintColor?: ?(string | SemanticOrDynamicColorType), - thumbTintColor?: ?(string | SemanticOrDynamicColorType), - tintColor?: ?(string | SemanticOrDynamicColorType), + onTintColor?: ?(string | NativeOrDynamicColorType), + thumbTintColor?: ?(string | NativeOrDynamicColorType), + tintColor?: ?(string | NativeOrDynamicColorType), |}>; type SwitchNativeComponentType = Class< diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js index 261bc0a6f3cc77..26867c412bf9e3 100644 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js +++ b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js @@ -16,7 +16,7 @@ import type {SyntheticEvent} from 'CoreEventTypes'; import type {ImageSource} from 'ImageSource'; import type {ViewProps} from 'ViewPropTypes'; import type {NativeComponent} from 'ReactNative'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) type Action = $ReadOnly<{| title: string, @@ -36,7 +36,7 @@ type NativeProps = $ReadOnly<{| nativeActions?: Array, |}>; -type ColorValue = null | string | SemanticOrDynamicColorType; +type ColorValue = null | string | NativeOrDynamicColorType; type ToolbarAndroidProps = $ReadOnly<{| ...ViewProps, diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index 57911ad9d93e5b..6be9a2dea464ae 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -24,7 +24,7 @@ const ensurePositiveDelayProps = require('ensurePositiveDelayProps'); const processColor = require('processColor'); import type {PressEvent} from 'CoreEventTypes'; -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) const rippleBackgroundPropType = PropTypes.shape({ type: PropTypes.oneOf(['RippleAndroid']), @@ -146,7 +146,7 @@ const TouchableNativeFeedback = createReactClass({ borderless: boolean, ): { type: 'RippleAndroid', - color: ?(number | SemanticOrDynamicColorType), + color: ?(number | NativeOrDynamicColorType), borderless: boolean, } { return { diff --git a/Libraries/ReactNative/getNativeComponentAttributes.js b/Libraries/ReactNative/getNativeComponentAttributes.js index 12a510f50c7a2f..3b01d6753b285c 100644 --- a/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/Libraries/ReactNative/getNativeComponentAttributes.js @@ -21,7 +21,7 @@ const resolveAssetSource = require('resolveAssetSource'); const sizesDiffer = require('sizesDiffer'); const invariant = require('invariant'); const warning = require('fbjs/lib/warning'); -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) function getNativeComponentAttributes(uiViewClassName: string) { const viewConfig = UIManager.getViewManagerConfig(uiViewClassName); @@ -184,7 +184,7 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any { function processColorArray( colors: ?Array, -): ?Array { +): ?Array { // ]TODO(macOS ISS#2323203) return colors == null ? null : colors.map(processColor); } diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index c2982b0642a217..0c719a69d20bb0 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -11,9 +11,9 @@ 'use strict'; const AnimatedNode = require('AnimatedNode'); -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // TODO(macOS ISS#2323203) -export type ColorValue = null | string | SemanticOrDynamicColorType; // TODO(macOS ISS#2323203) +export type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) export type DimensionValue = null | number | string | AnimatedNode; /** diff --git a/Libraries/StyleSheet/processColor.js b/Libraries/StyleSheet/processColor.js index b49afd5d7b71c1..6ab8d68721d629 100644 --- a/Libraries/StyleSheet/processColor.js +++ b/Libraries/StyleSheet/processColor.js @@ -11,14 +11,14 @@ 'use strict'; const Platform = require('Platform'); - +const processColorObject = require('processColorObject'); const normalizeColor = require('normalizeColor'); -import type {SemanticOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) /* eslint no-bitwise: 0 */ function processColor( - color?: ?(string | number | SemanticOrDynamicColorType), -): ?(number | SemanticOrDynamicColorType) /* TODO(macOS ISS#2323203) */ { + color?: ?(string | number | NativeOrDynamicColorType), +): ?(number | NativeOrDynamicColorType) /* TODO(macOS ISS#2323203) */ { if (color === undefined || color === null) { return color; } @@ -28,23 +28,14 @@ function processColor( return undefined; } - // [TODO(macOS ISS#2323203) - if ( - typeof int32Color === 'object' && - (Platform.OS === 'macos' || Platform.OS === 'ios') - ) { - if ('dynamic' in int32Color && int32Color.dynamic !== undefined) { - const dynamic = int32Color.dynamic; - const dynamicColor = { - dynamic: { - light: processColor(dynamic.light), - dark: processColor(dynamic.dark), - }, - }; - return dynamicColor; + if (typeof int32Color === 'object') { + const processedColorObj = processColorObject(int32Color); + + if (processedColorObj !== null) { + return processedColorObj; } - return int32Color; } + if (typeof int32Color !== 'number') { return null; } // ]TODO(macOS ISS#2323203) diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js new file mode 100644 index 00000000000000..31732473c49f6f --- /dev/null +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -0,0 +1,20 @@ +import type {NativeOrDynamicColorType} from 'normalizeColor'; +const processColor = require('processColor'); + +function processColorObject( + color?: ?(NativeOrDynamicColorType), +): ?(NativeOrDynamicColorType) { + if ('dynamic' in color && color.dynamic !== undefined) { + const dynamic = color.dynamic; + const dynamicColor = { + dynamic: { + light: processColor(dynamic.light), + dark: processColor(dynamic.dark), + }, + }; + return dynamicColor; + } + return color; +} + +module.exports = processColorObject; diff --git a/Libraries/StyleSheet/processColorObject.js b/Libraries/StyleSheet/processColorObject.js new file mode 100644 index 00000000000000..d8bfa07b8f2aa9 --- /dev/null +++ b/Libraries/StyleSheet/processColorObject.js @@ -0,0 +1,7 @@ +import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) + +function processColorObject( + color?: ?(NativeOrDynamicColorType), + ): ?(NativeOrDynamicColorType) /* TODO(macOS ISS#2323203) */ { + return null; +} \ No newline at end of file diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js new file mode 100644 index 00000000000000..31732473c49f6f --- /dev/null +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -0,0 +1,20 @@ +import type {NativeOrDynamicColorType} from 'normalizeColor'; +const processColor = require('processColor'); + +function processColorObject( + color?: ?(NativeOrDynamicColorType), +): ?(NativeOrDynamicColorType) { + if ('dynamic' in color && color.dynamic !== undefined) { + const dynamic = color.dynamic; + const dynamicColor = { + dynamic: { + light: processColor(dynamic.light), + dark: processColor(dynamic.dark), + }, + }; + return dynamicColor; + } + return color; +} + +module.exports = processColorObject; From 1ef11c313781fc5c90b248b2299715e3568382e6 Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 16:01:27 -0700 Subject: [PATCH 02/13] run prettier --- Libraries/Color/normalizeColor.js | 2 +- Libraries/Color/normalizeColorObject.ios.js | 55 +++++++++++-------- Libraries/Color/normalizeColorObject.js | 20 +++++-- Libraries/Color/normalizeColorObject.macos.js | 55 +++++++++++-------- .../StyleSheet/processColorObject.ios.js | 16 +++++- Libraries/StyleSheet/processColorObject.js | 19 +++++-- .../StyleSheet/processColorObject.macos.js | 16 +++++- 7 files changed, 126 insertions(+), 57 deletions(-) diff --git a/Libraries/Color/normalizeColor.js b/Libraries/Color/normalizeColor.js index cffe6ae3898fa1..17125b9af37b10 100755 --- a/Libraries/Color/normalizeColor.js +++ b/Libraries/Color/normalizeColor.js @@ -12,7 +12,7 @@ 'use strict'; const normalizeColorObject = require('normalizeColorObject'); -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; export {NativeOrDynamicColorType} from 'normalizeColorObject'; diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index e44a2350ab8661..e7673544868cb0 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -1,31 +1,42 @@ +/** + * 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-local + */ + +'use strict'; + const normalizeColor = require('normalizeColor'); export type NativeOrDynamicColorType = { - semantic?: string, - dynamic?: { - light: ?(string | number | NativeOrDynamicColorType), - dark: ?(string | number | NativeOrDynamicColorType), - }, + semantic?: string, + dynamic?: { + light: ?(string | number | NativeOrDynamicColorType), + dark: ?(string | number | NativeOrDynamicColorType), + }, }; function normalizeColorObject( - color: ? NativeOrDynamicColorType, - ): ?(number | NativeOrDynamicColorType) { - - if ('semantic' in color) { - // a macos semantic color - return color; - } else if ('dynamic' in color && color.dynamic !== undefined) { - // a dynamic, appearance aware color - const dynamic = color.dynamic; - const dynamicColor: NativeColorType = { - dynamic: { - light: normalizeColor(dynamic.light), - dark: normalizeColor(dynamic.dark), - }, - }; - return dynamicColor; - } + color: ?NativeOrDynamicColorType, +): ?(number | NativeOrDynamicColorType) { + if ('semantic' in color) { + // a macos semantic color + return color; + } else if ('dynamic' in color && color.dynamic !== undefined) { + // a dynamic, appearance aware color + const dynamic = color.dynamic; + const dynamicColor: NativeColorType = { + dynamic: { + light: normalizeColor(dynamic.light), + dark: normalizeColor(dynamic.dark), + }, + }; + return dynamicColor; + } } module.exports = normalizeColorObject; diff --git a/Libraries/Color/normalizeColorObject.js b/Libraries/Color/normalizeColorObject.js index fc5eec3345bbaa..d7ecf044c0765e 100644 --- a/Libraries/Color/normalizeColorObject.js +++ b/Libraries/Color/normalizeColorObject.js @@ -1,9 +1,21 @@ -export type NativeOrDynamicColorType = { }; +/** + * 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-local + */ + +'use strict'; + +export type NativeOrDynamicColorType = {}; function normalizeColorObject( - color: ? NativeOrDynamicColorType, - ): ?(number | NativeOrDynamicColorType) { - return null; + color: ?NativeOrDynamicColorType, +): ?(number | NativeOrDynamicColorType) { + return null; } module.exports = normalizeColorObject; diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index e44a2350ab8661..e7673544868cb0 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -1,31 +1,42 @@ +/** + * 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-local + */ + +'use strict'; + const normalizeColor = require('normalizeColor'); export type NativeOrDynamicColorType = { - semantic?: string, - dynamic?: { - light: ?(string | number | NativeOrDynamicColorType), - dark: ?(string | number | NativeOrDynamicColorType), - }, + semantic?: string, + dynamic?: { + light: ?(string | number | NativeOrDynamicColorType), + dark: ?(string | number | NativeOrDynamicColorType), + }, }; function normalizeColorObject( - color: ? NativeOrDynamicColorType, - ): ?(number | NativeOrDynamicColorType) { - - if ('semantic' in color) { - // a macos semantic color - return color; - } else if ('dynamic' in color && color.dynamic !== undefined) { - // a dynamic, appearance aware color - const dynamic = color.dynamic; - const dynamicColor: NativeColorType = { - dynamic: { - light: normalizeColor(dynamic.light), - dark: normalizeColor(dynamic.dark), - }, - }; - return dynamicColor; - } + color: ?NativeOrDynamicColorType, +): ?(number | NativeOrDynamicColorType) { + if ('semantic' in color) { + // a macos semantic color + return color; + } else if ('dynamic' in color && color.dynamic !== undefined) { + // a dynamic, appearance aware color + const dynamic = color.dynamic; + const dynamicColor: NativeColorType = { + dynamic: { + light: normalizeColor(dynamic.light), + dark: normalizeColor(dynamic.dark), + }, + }; + return dynamicColor; + } } module.exports = normalizeColorObject; diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index 31732473c49f6f..cdac00955b2467 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -1,9 +1,21 @@ +/** + * 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-local + */ + +'use strict'; + import type {NativeOrDynamicColorType} from 'normalizeColor'; const processColor = require('processColor'); function processColorObject( - color?: ?(NativeOrDynamicColorType), -): ?(NativeOrDynamicColorType) { + color?: ?NativeOrDynamicColorType, +): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { const dynamic = color.dynamic; const dynamicColor = { diff --git a/Libraries/StyleSheet/processColorObject.js b/Libraries/StyleSheet/processColorObject.js index d8bfa07b8f2aa9..821a64ce9f728f 100644 --- a/Libraries/StyleSheet/processColorObject.js +++ b/Libraries/StyleSheet/processColorObject.js @@ -1,7 +1,18 @@ +/** + * 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-local + */ + +'use strict'; import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) function processColorObject( - color?: ?(NativeOrDynamicColorType), - ): ?(NativeOrDynamicColorType) /* TODO(macOS ISS#2323203) */ { - return null; -} \ No newline at end of file + color?: ?NativeOrDynamicColorType, +): ?NativeOrDynamicColorType /* TODO(macOS ISS#2323203) */ { + return null; +} diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index 31732473c49f6f..cdac00955b2467 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -1,9 +1,21 @@ +/** + * 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-local + */ + +'use strict'; + import type {NativeOrDynamicColorType} from 'normalizeColor'; const processColor = require('processColor'); function processColorObject( - color?: ?(NativeOrDynamicColorType), -): ?(NativeOrDynamicColorType) { + color?: ?NativeOrDynamicColorType, +): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { const dynamic = color.dynamic; const dynamicColor = { From abae00fb82004bfe15d206e2dc0d9a71817aeece Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 16:11:49 -0700 Subject: [PATCH 03/13] Fix NativeColorType reference in normalizeColorObject --- Libraries/Color/normalizeColorObject.ios.js | 2 +- Libraries/Color/normalizeColorObject.macos.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index e7673544868cb0..dd8f5161569d14 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -29,7 +29,7 @@ function normalizeColorObject( } else if ('dynamic' in color && color.dynamic !== undefined) { // a dynamic, appearance aware color const dynamic = color.dynamic; - const dynamicColor: NativeColorType = { + const dynamicColor: NativeOrDynamicColorType = { dynamic: { light: normalizeColor(dynamic.light), dark: normalizeColor(dynamic.dark), diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index e7673544868cb0..dd8f5161569d14 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -29,7 +29,7 @@ function normalizeColorObject( } else if ('dynamic' in color && color.dynamic !== undefined) { // a dynamic, appearance aware color const dynamic = color.dynamic; - const dynamicColor: NativeColorType = { + const dynamicColor: NativeOrDynamicColorType = { dynamic: { light: normalizeColor(dynamic.light), dark: normalizeColor(dynamic.dark), From 0d4729bf8729258c2265b25ac6f8b7adb3e4511f Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 16:30:22 -0700 Subject: [PATCH 04/13] return null in normalizeColorObject for invalid objects --- Libraries/Color/normalizeColorObject.ios.js | 2 ++ Libraries/Color/normalizeColorObject.macos.js | 2 ++ Libraries/StyleSheet/processColorObject.js | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index dd8f5161569d14..833d6da4ca46c0 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -37,6 +37,8 @@ function normalizeColorObject( }; return dynamicColor; } + + return null; } module.exports = normalizeColorObject; diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index dd8f5161569d14..833d6da4ca46c0 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -37,6 +37,8 @@ function normalizeColorObject( }; return dynamicColor; } + + return null; } module.exports = normalizeColorObject; diff --git a/Libraries/StyleSheet/processColorObject.js b/Libraries/StyleSheet/processColorObject.js index 821a64ce9f728f..0952df18440853 100644 --- a/Libraries/StyleSheet/processColorObject.js +++ b/Libraries/StyleSheet/processColorObject.js @@ -9,6 +9,7 @@ */ 'use strict'; + import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) function processColorObject( @@ -16,3 +17,5 @@ function processColorObject( ): ?NativeOrDynamicColorType /* TODO(macOS ISS#2323203) */ { return null; } + +module.exports = processColorObject; From f4b30bfd6d967019813efeca7aa91b9b1d5b93fe Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 18:04:21 -0700 Subject: [PATCH 05/13] import NativeOrDynamicColorType from normalizeColorObject --- Libraries/Color/normalizeColor.js | 2 -- .../RCTActivityIndicatorViewNativeComponent.js | 2 +- .../DrawerAndroid/AndroidDrawerLayoutNativeComponent.js | 2 +- Libraries/Components/Picker/PickerIOS.ios.js | 2 +- Libraries/Components/Picker/RCTPickerNativeComponent.js | 2 +- Libraries/Components/Switch/SwitchNativeComponent.js | 2 +- .../Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js | 2 +- .../Components/Touchable/TouchableNativeFeedback.android.js | 2 +- Libraries/ReactNative/getNativeComponentAttributes.js | 2 +- Libraries/StyleSheet/StyleSheetTypes.js | 2 +- Libraries/StyleSheet/processColor.js | 2 +- Libraries/StyleSheet/processColorObject.ios.js | 2 +- Libraries/StyleSheet/processColorObject.js | 2 +- Libraries/StyleSheet/processColorObject.macos.js | 2 +- 14 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Libraries/Color/normalizeColor.js b/Libraries/Color/normalizeColor.js index 17125b9af37b10..613a1809e5e3bf 100755 --- a/Libraries/Color/normalizeColor.js +++ b/Libraries/Color/normalizeColor.js @@ -14,8 +14,6 @@ const normalizeColorObject = require('normalizeColorObject'); import type {NativeOrDynamicColorType} from 'normalizeColorObject'; -export {NativeOrDynamicColorType} from 'normalizeColorObject'; - function normalizeColor( color: ?( | string diff --git a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js index 9141642be475f3..ade1478c17e5e3 100644 --- a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js +++ b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js @@ -15,7 +15,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; import type {ViewStyleProp} from 'StyleSheet'; import type {NativeComponent} from 'ReactNative'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js index 47f002aa49e68e..45cc2a73709c11 100644 --- a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +++ b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js @@ -16,7 +16,7 @@ import type {NativeComponent} from 'ReactNative'; import type {SyntheticEvent} from 'CoreEventTypes'; import type {ViewStyleProp} from 'StyleSheet'; import type React from 'React'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) type ColorValue = null | string | NativeOrDynamicColorType; diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index ced72dbb37442a..637266b33a795a 100644 --- a/Libraries/Components/Picker/PickerIOS.ios.js +++ b/Libraries/Components/Picker/PickerIOS.ios.js @@ -24,7 +24,7 @@ import type {SyntheticEvent} from 'CoreEventTypes'; import type {ColorValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; import type {TextStyleProp} from 'StyleSheet'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| diff --git a/Libraries/Components/Picker/RCTPickerNativeComponent.js b/Libraries/Components/Picker/RCTPickerNativeComponent.js index feb00ba17241c5..c69699acb86506 100644 --- a/Libraries/Components/Picker/RCTPickerNativeComponent.js +++ b/Libraries/Components/Picker/RCTPickerNativeComponent.js @@ -14,7 +14,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {SyntheticEvent} from 'CoreEventTypes'; import type {TextStyleProp} from 'StyleSheet'; import type {NativeComponent} from 'ReactNative'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| diff --git a/Libraries/Components/Switch/SwitchNativeComponent.js b/Libraries/Components/Switch/SwitchNativeComponent.js index 3d85ed6905a23e..c4727a4b85a67c 100644 --- a/Libraries/Components/Switch/SwitchNativeComponent.js +++ b/Libraries/Components/Switch/SwitchNativeComponent.js @@ -17,7 +17,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {SwitchChangeEvent} from 'CoreEventTypes'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) type SwitchProps = $ReadOnly<{| ...ViewProps, diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js index 26867c412bf9e3..3829326ed4a27a 100644 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js +++ b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js @@ -16,7 +16,7 @@ import type {SyntheticEvent} from 'CoreEventTypes'; import type {ImageSource} from 'ImageSource'; import type {ViewProps} from 'ViewPropTypes'; import type {NativeComponent} from 'ReactNative'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) type Action = $ReadOnly<{| title: string, diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index 6be9a2dea464ae..51d2ba7c4c08c2 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -24,7 +24,7 @@ const ensurePositiveDelayProps = require('ensurePositiveDelayProps'); const processColor = require('processColor'); import type {PressEvent} from 'CoreEventTypes'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) const rippleBackgroundPropType = PropTypes.shape({ type: PropTypes.oneOf(['RippleAndroid']), diff --git a/Libraries/ReactNative/getNativeComponentAttributes.js b/Libraries/ReactNative/getNativeComponentAttributes.js index 3b01d6753b285c..47a0da5ab3996a 100644 --- a/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/Libraries/ReactNative/getNativeComponentAttributes.js @@ -21,7 +21,7 @@ const resolveAssetSource = require('resolveAssetSource'); const sizesDiffer = require('sizesDiffer'); const invariant = require('invariant'); const warning = require('fbjs/lib/warning'); -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) function getNativeComponentAttributes(uiViewClassName: string) { const viewConfig = UIManager.getViewManagerConfig(uiViewClassName); diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index 0c719a69d20bb0..76f05ede9fd261 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -11,7 +11,7 @@ 'use strict'; const AnimatedNode = require('AnimatedNode'); -import type {NativeOrDynamicColorType} from 'normalizeColor'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) export type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) export type DimensionValue = null | number | string | AnimatedNode; diff --git a/Libraries/StyleSheet/processColor.js b/Libraries/StyleSheet/processColor.js index 6ab8d68721d629..e75a939f295369 100644 --- a/Libraries/StyleSheet/processColor.js +++ b/Libraries/StyleSheet/processColor.js @@ -13,7 +13,7 @@ const Platform = require('Platform'); const processColorObject = require('processColorObject'); const normalizeColor = require('normalizeColor'); -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) /* eslint no-bitwise: 0 */ function processColor( diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index cdac00955b2467..d8742a10a43e1f 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -10,7 +10,7 @@ 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; const processColor = require('processColor'); function processColorObject( diff --git a/Libraries/StyleSheet/processColorObject.js b/Libraries/StyleSheet/processColorObject.js index 0952df18440853..8dbc96a2116a20 100644 --- a/Libraries/StyleSheet/processColorObject.js +++ b/Libraries/StyleSheet/processColorObject.js @@ -10,7 +10,7 @@ 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) function processColorObject( color?: ?NativeOrDynamicColorType, diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index cdac00955b2467..d8742a10a43e1f 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -10,7 +10,7 @@ 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; const processColor = require('processColor'); function processColorObject( From 5bcecc18cd897543944b9bcc7e027a2b8e3eb4a5 Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 18:22:15 -0700 Subject: [PATCH 06/13] remove strict-local --- Libraries/Color/normalizeColorObject.ios.js | 2 +- Libraries/Color/normalizeColorObject.js | 2 +- Libraries/Color/normalizeColorObject.macos.js | 2 +- Libraries/StyleSheet/processColorObject.ios.js | 2 +- Libraries/StyleSheet/processColorObject.js | 2 +- Libraries/StyleSheet/processColorObject.macos.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index 833d6da4ca46c0..09c6fda0141a36 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow */ 'use strict'; diff --git a/Libraries/Color/normalizeColorObject.js b/Libraries/Color/normalizeColorObject.js index d7ecf044c0765e..a7e9450f0afe06 100644 --- a/Libraries/Color/normalizeColorObject.js +++ b/Libraries/Color/normalizeColorObject.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow */ 'use strict'; diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index 833d6da4ca46c0..09c6fda0141a36 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow */ 'use strict'; diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index d8742a10a43e1f..6b98ec02b5de32 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow */ 'use strict'; diff --git a/Libraries/StyleSheet/processColorObject.js b/Libraries/StyleSheet/processColorObject.js index 8dbc96a2116a20..27f10c0095795c 100644 --- a/Libraries/StyleSheet/processColorObject.js +++ b/Libraries/StyleSheet/processColorObject.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow */ 'use strict'; diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index d8742a10a43e1f..6b98ec02b5de32 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow */ 'use strict'; From c99eea9f34b62b9981d1de15f207bdb4b0c1d934 Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 18:35:03 -0700 Subject: [PATCH 07/13] add normalize/processColorObject.android.js --- .../{normalizeColorObject.js => normalizeColorObject.android.js} | 0 .../{processColorObject.js => processColorObject.android.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Libraries/Color/{normalizeColorObject.js => normalizeColorObject.android.js} (100%) rename Libraries/StyleSheet/{processColorObject.js => processColorObject.android.js} (100%) diff --git a/Libraries/Color/normalizeColorObject.js b/Libraries/Color/normalizeColorObject.android.js similarity index 100% rename from Libraries/Color/normalizeColorObject.js rename to Libraries/Color/normalizeColorObject.android.js diff --git a/Libraries/StyleSheet/processColorObject.js b/Libraries/StyleSheet/processColorObject.android.js similarity index 100% rename from Libraries/StyleSheet/processColorObject.js rename to Libraries/StyleSheet/processColorObject.android.js From dad7b542ab4ca4b89e0c0a25b59f4519882d8e0a Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 20:33:16 -0700 Subject: [PATCH 08/13] normalize/processColorObject param --- Libraries/Color/normalizeColorObject.android.js | 2 +- Libraries/Color/normalizeColorObject.ios.js | 2 +- Libraries/Color/normalizeColorObject.macos.js | 2 +- Libraries/StyleSheet/processColorObject.android.js | 2 +- Libraries/StyleSheet/processColorObject.ios.js | 2 +- Libraries/StyleSheet/processColorObject.macos.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Libraries/Color/normalizeColorObject.android.js b/Libraries/Color/normalizeColorObject.android.js index a7e9450f0afe06..b60be8ef5973fd 100644 --- a/Libraries/Color/normalizeColorObject.android.js +++ b/Libraries/Color/normalizeColorObject.android.js @@ -13,7 +13,7 @@ export type NativeOrDynamicColorType = {}; function normalizeColorObject( - color: ?NativeOrDynamicColorType, + color: NativeOrDynamicColorType, ): ?(number | NativeOrDynamicColorType) { return null; } diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index 09c6fda0141a36..32749e2e86516e 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -21,7 +21,7 @@ export type NativeOrDynamicColorType = { }; function normalizeColorObject( - color: ?NativeOrDynamicColorType, + color: NativeOrDynamicColorType, ): ?(number | NativeOrDynamicColorType) { if ('semantic' in color) { // a macos semantic color diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index 09c6fda0141a36..32749e2e86516e 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -21,7 +21,7 @@ export type NativeOrDynamicColorType = { }; function normalizeColorObject( - color: ?NativeOrDynamicColorType, + color: NativeOrDynamicColorType, ): ?(number | NativeOrDynamicColorType) { if ('semantic' in color) { // a macos semantic color diff --git a/Libraries/StyleSheet/processColorObject.android.js b/Libraries/StyleSheet/processColorObject.android.js index 27f10c0095795c..6c8f5197d3a525 100644 --- a/Libraries/StyleSheet/processColorObject.android.js +++ b/Libraries/StyleSheet/processColorObject.android.js @@ -13,7 +13,7 @@ import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) function processColorObject( - color?: ?NativeOrDynamicColorType, + color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType /* TODO(macOS ISS#2323203) */ { return null; } diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index 6b98ec02b5de32..b0ea57b78dbfe5 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -14,7 +14,7 @@ import type {NativeOrDynamicColorType} from 'normalizeColorObject'; const processColor = require('processColor'); function processColorObject( - color?: ?NativeOrDynamicColorType, + color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { const dynamic = color.dynamic; diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index 6b98ec02b5de32..b0ea57b78dbfe5 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -14,7 +14,7 @@ import type {NativeOrDynamicColorType} from 'normalizeColorObject'; const processColor = require('processColor'); function processColorObject( - color?: ?NativeOrDynamicColorType, + color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { const dynamic = color.dynamic; From bad984d8ba5c57282ec548ddce0b4bcdba009103 Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 20:38:20 -0700 Subject: [PATCH 09/13] missed one NativeOrDynamicColorType import --- Libraries/Components/ActivityIndicator/ActivityIndicator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 13965d6a22cbe6..c2d95c2072706b 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -19,7 +19,7 @@ const RCTActivityIndicatorViewNativeComponent = require('RCTActivityIndicatorVie import type {NativeComponent} from 'ReactNative'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeOrDynamicColorType} from 'normalizeColor'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) const RCTActivityIndicator = Platform.OS === 'android' From 5dc4c9da46165cd9ffa33db32d0de53e6ba7e61f Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Thu, 22 Aug 2019 21:18:00 -0700 Subject: [PATCH 10/13] NativeOrDynamicColorType as processColorObject's return type --- Libraries/StyleSheet/processColorObject.ios.js | 2 +- Libraries/StyleSheet/processColorObject.macos.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index b0ea57b78dbfe5..8a2e5b424f4d92 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -18,7 +18,7 @@ function processColorObject( ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { const dynamic = color.dynamic; - const dynamicColor = { + const dynamicColor: NativeOrDynamicColorType = { dynamic: { light: processColor(dynamic.light), dark: processColor(dynamic.dark), diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index b0ea57b78dbfe5..8a2e5b424f4d92 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -18,7 +18,7 @@ function processColorObject( ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { const dynamic = color.dynamic; - const dynamicColor = { + const dynamicColor: NativeOrDynamicColorType = { dynamic: { light: processColor(dynamic.light), dark: processColor(dynamic.dark), From c00a2d7dc48b9cb71ef344577047172ae49bbf7f Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Fri, 23 Aug 2019 11:04:38 -0700 Subject: [PATCH 11/13] ignore macos files in android's flowconfig --- .flowconfig.android | 1 + 1 file changed, 1 insertion(+) diff --git a/.flowconfig.android b/.flowconfig.android index 9ff8ac48e050fd..1349bd82fdc1d1 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -1,6 +1,7 @@ [ignore] ; We fork some components by platform .*/*[.]ios.js +.*/*[.]macos.js ; Ignore templates for 'react-native init' /template/.* From ce1a2728dd5c713a8e1fc829c532e9dd9ccfca68 Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Fri, 23 Aug 2019 13:34:12 -0700 Subject: [PATCH 12/13] Move normalizeColor require --- Libraries/Color/normalizeColorObject.ios.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index 32749e2e86516e..7aed691db9101e 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -10,8 +10,6 @@ 'use strict'; -const normalizeColor = require('normalizeColor'); - export type NativeOrDynamicColorType = { semantic?: string, dynamic?: { @@ -27,6 +25,8 @@ function normalizeColorObject( // a macos semantic color return color; } else if ('dynamic' in color && color.dynamic !== undefined) { + const normalizeColor = require('normalizeColor'); + // a dynamic, appearance aware color const dynamic = color.dynamic; const dynamicColor: NativeOrDynamicColorType = { From e199a91976117b0ef6d84ea5cfb0e5505111a08c Mon Sep 17 00:00:00 2001 From: Marlene Cota Date: Mon, 26 Aug 2019 13:51:06 -0700 Subject: [PATCH 13/13] Add/fix TODO(macOS ISS#2323203) comments --- Libraries/Color/normalizeColor.js | 5 +++-- Libraries/Color/normalizeColorObject.android.js | 3 ++- Libraries/Color/normalizeColorObject.ios.js | 3 ++- Libraries/Color/normalizeColorObject.macos.js | 3 ++- .../Components/ActivityIndicator/ActivityIndicator.js | 4 ++-- .../RCTActivityIndicatorViewNativeComponent.js | 4 ++-- .../AndroidDrawerLayoutNativeComponent.js | 4 ++-- Libraries/Components/Picker/PickerIOS.ios.js | 4 ++-- .../Components/Picker/RCTPickerNativeComponent.js | 4 ++-- Libraries/Components/Switch/SwitchNativeComponent.js | 10 +++++----- .../ToolbarAndroid/ToolbarAndroidNativeComponent.js | 4 ++-- .../Touchable/TouchableNativeFeedback.android.js | 4 ++-- Libraries/ReactNative/getNativeComponentAttributes.js | 4 ++-- Libraries/StyleSheet/processColor.js | 4 ++-- Libraries/StyleSheet/processColorObject.android.js | 7 ++++--- Libraries/StyleSheet/processColorObject.ios.js | 3 ++- Libraries/StyleSheet/processColorObject.macos.js | 3 ++- 17 files changed, 40 insertions(+), 33 deletions(-) diff --git a/Libraries/Color/normalizeColor.js b/Libraries/Color/normalizeColor.js index 613a1809e5e3bf..f92b41a3e0767e 100755 --- a/Libraries/Color/normalizeColor.js +++ b/Libraries/Color/normalizeColor.js @@ -11,8 +11,8 @@ /* eslint no-bitwise: 0 */ 'use strict'; -const normalizeColorObject = require('normalizeColorObject'); -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; +const normalizeColorObject = require('normalizeColorObject'); // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) function normalizeColor( color: ?( @@ -31,6 +31,7 @@ function normalizeColor( return null; } + // [TODO(macOS ISS#2323203) if (typeof color === 'object' && color !== null) { const normalizedColorObj = normalizeColorObject(color); diff --git a/Libraries/Color/normalizeColorObject.android.js b/Libraries/Color/normalizeColorObject.android.js index b60be8ef5973fd..93d3acb5aebc77 100644 --- a/Libraries/Color/normalizeColorObject.android.js +++ b/Libraries/Color/normalizeColorObject.android.js @@ -7,7 +7,7 @@ * @format * @flow */ - +// [TODO(macOS ISS#2323203) 'use strict'; export type NativeOrDynamicColorType = {}; @@ -19,3 +19,4 @@ function normalizeColorObject( } module.exports = normalizeColorObject; +// ]TODO(macOS ISS#2323203) diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index 7aed691db9101e..018bf589d428d2 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -7,7 +7,7 @@ * @format * @flow */ - +// [TODO(macOS ISS#2323203) 'use strict'; export type NativeOrDynamicColorType = { @@ -42,3 +42,4 @@ function normalizeColorObject( } module.exports = normalizeColorObject; +// ]TODO(macOS ISS#2323203) diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index 32749e2e86516e..2092ceff12f348 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -7,7 +7,7 @@ * @format * @flow */ - +// [TODO(macOS ISS#2323203) 'use strict'; const normalizeColor = require('normalizeColor'); @@ -42,3 +42,4 @@ function normalizeColorObject( } module.exports = normalizeColorObject; +// ]TODO(macOS ISS#2323203) diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index c2d95c2072706b..7d9d1539f73f2d 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -19,7 +19,7 @@ const RCTActivityIndicatorViewNativeComponent = require('RCTActivityIndicatorVie import type {NativeComponent} from 'ReactNative'; import type {ViewProps} from 'ViewPropTypes'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) const RCTActivityIndicator = Platform.OS === 'android' @@ -54,7 +54,7 @@ type Props = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html#color */ - color?: ?(string | NativeOrDynamicColorType), // ]TODO(macOS ISS#2323203) + color?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) /** * Size of the indicator (default is 'small'). diff --git a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js index ade1478c17e5e3..00852da8e97e3f 100644 --- a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js +++ b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js @@ -15,7 +15,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; import type {ViewStyleProp} from 'StyleSheet'; import type {NativeComponent} from 'ReactNative'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) type NativeProps = $ReadOnly<{| ...ViewProps, @@ -39,7 +39,7 @@ type NativeProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/activityindicator.html#color */ - color?: ?(string | NativeOrDynamicColorType), + color?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) /** * Size of the indicator (default is 'small'). diff --git a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js index 45cc2a73709c11..0563d25ae83ee4 100644 --- a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +++ b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js @@ -16,9 +16,9 @@ import type {NativeComponent} from 'ReactNative'; import type {SyntheticEvent} from 'CoreEventTypes'; import type {ViewStyleProp} from 'StyleSheet'; import type React from 'React'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) -type ColorValue = null | string | NativeOrDynamicColorType; +type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) type DrawerStates = 'Idle' | 'Dragging' | 'Settling'; diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index 637266b33a795a..3454f0a69f9d48 100644 --- a/Libraries/Components/Picker/PickerIOS.ios.js +++ b/Libraries/Components/Picker/PickerIOS.ios.js @@ -24,7 +24,7 @@ import type {SyntheticEvent} from 'CoreEventTypes'; import type {ColorValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; import type {TextStyleProp} from 'StyleSheet'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| @@ -36,7 +36,7 @@ type PickerIOSChangeEvent = SyntheticEvent< type RCTPickerIOSItemType = $ReadOnly<{| label: ?Label, value: ?(number | string), - textColor: ?(number | NativeOrDynamicColorType), // ]TODO(macOS ISS#2323203) + textColor: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) |}>; type RCTPickerIOSType = Class< diff --git a/Libraries/Components/Picker/RCTPickerNativeComponent.js b/Libraries/Components/Picker/RCTPickerNativeComponent.js index c69699acb86506..0e1ed250778bf7 100644 --- a/Libraries/Components/Picker/RCTPickerNativeComponent.js +++ b/Libraries/Components/Picker/RCTPickerNativeComponent.js @@ -14,7 +14,7 @@ const requireNativeComponent = require('requireNativeComponent'); import type {SyntheticEvent} from 'CoreEventTypes'; import type {TextStyleProp} from 'StyleSheet'; import type {NativeComponent} from 'ReactNative'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| @@ -26,7 +26,7 @@ type PickerIOSChangeEvent = SyntheticEvent< type RCTPickerIOSItemType = $ReadOnly<{| label: ?Label, value: ?(number | string), - textColor: ?(number | NativeOrDynamicColorType), + textColor: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) |}>; type Label = Stringish | number; diff --git a/Libraries/Components/Switch/SwitchNativeComponent.js b/Libraries/Components/Switch/SwitchNativeComponent.js index c4727a4b85a67c..5d46d0f46d918d 100644 --- a/Libraries/Components/Switch/SwitchNativeComponent.js +++ b/Libraries/Components/Switch/SwitchNativeComponent.js @@ -35,17 +35,17 @@ export type NativeAndroidProps = $ReadOnly<{| enabled?: ?boolean, on?: ?boolean, - thumbTintColor?: ?(string | NativeOrDynamicColorType), - trackTintColor?: ?(string | NativeOrDynamicColorType), + thumbTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + trackTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) |}>; // @see RCTSwitchManager.m export type NativeIOSProps = $ReadOnly<{| ...SwitchProps, - onTintColor?: ?(string | NativeOrDynamicColorType), - thumbTintColor?: ?(string | NativeOrDynamicColorType), - tintColor?: ?(string | NativeOrDynamicColorType), + onTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + thumbTintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) + tintColor?: ?(string | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) |}>; type SwitchNativeComponentType = Class< diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js index 3829326ed4a27a..5dce58f2194ef3 100644 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js +++ b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js @@ -16,7 +16,7 @@ import type {SyntheticEvent} from 'CoreEventTypes'; import type {ImageSource} from 'ImageSource'; import type {ViewProps} from 'ViewPropTypes'; import type {NativeComponent} from 'ReactNative'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) type Action = $ReadOnly<{| title: string, @@ -36,7 +36,7 @@ type NativeProps = $ReadOnly<{| nativeActions?: Array, |}>; -type ColorValue = null | string | NativeOrDynamicColorType; +type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) type ToolbarAndroidProps = $ReadOnly<{| ...ViewProps, diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index 51d2ba7c4c08c2..b56dda54d56cbb 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -24,7 +24,7 @@ const ensurePositiveDelayProps = require('ensurePositiveDelayProps'); const processColor = require('processColor'); import type {PressEvent} from 'CoreEventTypes'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) const rippleBackgroundPropType = PropTypes.shape({ type: PropTypes.oneOf(['RippleAndroid']), @@ -146,7 +146,7 @@ const TouchableNativeFeedback = createReactClass({ borderless: boolean, ): { type: 'RippleAndroid', - color: ?(number | NativeOrDynamicColorType), + color: ?(number | NativeOrDynamicColorType), // TODO(macOS ISS#2323203) borderless: boolean, } { return { diff --git a/Libraries/ReactNative/getNativeComponentAttributes.js b/Libraries/ReactNative/getNativeComponentAttributes.js index 47a0da5ab3996a..ef28420179a9cb 100644 --- a/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/Libraries/ReactNative/getNativeComponentAttributes.js @@ -21,7 +21,7 @@ const resolveAssetSource = require('resolveAssetSource'); const sizesDiffer = require('sizesDiffer'); const invariant = require('invariant'); const warning = require('fbjs/lib/warning'); -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) function getNativeComponentAttributes(uiViewClassName: string) { const viewConfig = UIManager.getViewManagerConfig(uiViewClassName); @@ -184,7 +184,7 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any { function processColorArray( colors: ?Array, -): ?Array { +): ?Array /* TODO(macOS ISS#2323203) */ { // ]TODO(macOS ISS#2323203) return colors == null ? null : colors.map(processColor); } diff --git a/Libraries/StyleSheet/processColor.js b/Libraries/StyleSheet/processColor.js index e75a939f295369..fb5daf53d6659b 100644 --- a/Libraries/StyleSheet/processColor.js +++ b/Libraries/StyleSheet/processColor.js @@ -11,9 +11,9 @@ 'use strict'; const Platform = require('Platform'); -const processColorObject = require('processColorObject'); +const processColorObject = require('processColorObject'); // TODO(macOS ISS#2323203) const normalizeColor = require('normalizeColor'); -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) /* eslint no-bitwise: 0 */ function processColor( diff --git a/Libraries/StyleSheet/processColorObject.android.js b/Libraries/StyleSheet/processColorObject.android.js index 6c8f5197d3a525..f4bca8303002cc 100644 --- a/Libraries/StyleSheet/processColorObject.android.js +++ b/Libraries/StyleSheet/processColorObject.android.js @@ -7,15 +7,16 @@ * @format * @flow */ - +// [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // ]TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'normalizeColorObject'; function processColorObject( color: NativeOrDynamicColorType, -): ?NativeOrDynamicColorType /* TODO(macOS ISS#2323203) */ { +): ?NativeOrDynamicColorType { return null; } module.exports = processColorObject; +// ]TODO(macOS ISS#2323203) diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index 8a2e5b424f4d92..bfb86980754bd7 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -7,7 +7,7 @@ * @format * @flow */ - +// [TODO(macOS ISS#2323203) 'use strict'; import type {NativeOrDynamicColorType} from 'normalizeColorObject'; @@ -30,3 +30,4 @@ function processColorObject( } module.exports = processColorObject; +// ]TODO(macOS ISS#2323203) diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index 8a2e5b424f4d92..bfb86980754bd7 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -7,7 +7,7 @@ * @format * @flow */ - +// [TODO(macOS ISS#2323203) 'use strict'; import type {NativeOrDynamicColorType} from 'normalizeColorObject'; @@ -30,3 +30,4 @@ function processColorObject( } module.exports = processColorObject; +// ]TODO(macOS ISS#2323203)