diff --git a/Libraries/Color/NativeOrDynamicColorType.js b/Libraries/Color/NativeOrDynamicColorType.js new file mode 100644 index 00000000000000..a3a24dc7585f7d --- /dev/null +++ b/Libraries/Color/NativeOrDynamicColorType.js @@ -0,0 +1,19 @@ +/** + * 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'; + +export type NativeOrDynamicColorType = { + semantic?: string, + dynamic?: { + light: ?(string | number | NativeOrDynamicColorType), + dark: ?(string | number | NativeOrDynamicColorType), + }, +}; diff --git a/Libraries/Color/normalizeColor.js b/Libraries/Color/normalizeColor.js index eaa8226fd1c6b9..3ca9e3ae2b3895 100755 --- a/Libraries/Color/normalizeColor.js +++ b/Libraries/Color/normalizeColor.js @@ -11,7 +11,7 @@ /* eslint no-bitwise: 0 */ 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) function normalizeColor( color: ?( diff --git a/Libraries/Color/normalizeColorObject.android.js b/Libraries/Color/normalizeColorObject.android.js index 93d3acb5aebc77..f49f2bb38e0261 100644 --- a/Libraries/Color/normalizeColorObject.android.js +++ b/Libraries/Color/normalizeColorObject.android.js @@ -10,7 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -export type NativeOrDynamicColorType = {}; +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; function normalizeColorObject( color: NativeOrDynamicColorType, diff --git a/Libraries/Color/normalizeColorObject.ios.js b/Libraries/Color/normalizeColorObject.ios.js index 018bf589d428d2..8645bd4b783467 100644 --- a/Libraries/Color/normalizeColorObject.ios.js +++ b/Libraries/Color/normalizeColorObject.ios.js @@ -10,13 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -export type NativeOrDynamicColorType = { - semantic?: string, - dynamic?: { - light: ?(string | number | NativeOrDynamicColorType), - dark: ?(string | number | NativeOrDynamicColorType), - }, -}; +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; function normalizeColorObject( color: NativeOrDynamicColorType, diff --git a/Libraries/Color/normalizeColorObject.macos.js b/Libraries/Color/normalizeColorObject.macos.js index 018bf589d428d2..8645bd4b783467 100644 --- a/Libraries/Color/normalizeColorObject.macos.js +++ b/Libraries/Color/normalizeColorObject.macos.js @@ -10,13 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -export type NativeOrDynamicColorType = { - semantic?: string, - dynamic?: { - light: ?(string | number | NativeOrDynamicColorType), - dark: ?(string | number | NativeOrDynamicColorType), - }, -}; +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; function normalizeColorObject( color: NativeOrDynamicColorType, diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 7d9d1539f73f2d..2324d569f54bba 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 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) const RCTActivityIndicator = Platform.OS === 'android' diff --git a/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/RCTActivityIndicatorViewNativeComponent.js index 00852da8e97e3f..ba3edaf4d54cc2 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 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type NativeProps = $ReadOnly<{| ...ViewProps, diff --git a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js index 0563d25ae83ee4..38ca88759bee2d 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 'normalizeColorObject'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type ColorValue = null | string | NativeOrDynamicColorType; // TODO(macOS ISS#2323203) diff --git a/Libraries/Components/Picker/PickerIOS.ios.js b/Libraries/Components/Picker/PickerIOS.ios.js index 3454f0a69f9d48..3fcc2e692687a3 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 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| diff --git a/Libraries/Components/Picker/RCTPickerNativeComponent.js b/Libraries/Components/Picker/RCTPickerNativeComponent.js index 0e1ed250778bf7..e2e1f2c5d9f7d6 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 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type PickerIOSChangeEvent = SyntheticEvent< $ReadOnly<{| diff --git a/Libraries/Components/Switch/SwitchNativeComponent.js b/Libraries/Components/Switch/SwitchNativeComponent.js index 5d46d0f46d918d..09fcd064f1b99f 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 'normalizeColorObject'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; // TODO(macOS ISS#2323203) type SwitchProps = $ReadOnly<{| ...ViewProps, diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroidNativeComponent.js index 5dce58f2194ef3..cfeab36785fe9e 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 'NativeOrDynamicColorType'; // 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 b56dda54d56cbb..bf6ba0df3a0d99 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 'NativeOrDynamicColorType'; // 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 ef28420179a9cb..e62c5e1394e030 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 'NativeOrDynamicColorType'; // 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 76f05ede9fd261..711a0feda63037 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 'normalizeColorObject'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; // 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 423f1bcdedf618..6a66a6dfbc719e 100644 --- a/Libraries/StyleSheet/processColor.js +++ b/Libraries/StyleSheet/processColor.js @@ -12,7 +12,7 @@ const Platform = require('Platform'); const normalizeColor = require('normalizeColor'); -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; // TODO(macOS ISS#2323203) +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; // 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 f4bca8303002cc..d92b68d232bcf8 100644 --- a/Libraries/StyleSheet/processColorObject.android.js +++ b/Libraries/StyleSheet/processColorObject.android.js @@ -10,7 +10,7 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; function processColorObject( color: NativeOrDynamicColorType, diff --git a/Libraries/StyleSheet/processColorObject.ios.js b/Libraries/StyleSheet/processColorObject.ios.js index bfb86980754bd7..f5dedc8e947688 100644 --- a/Libraries/StyleSheet/processColorObject.ios.js +++ b/Libraries/StyleSheet/processColorObject.ios.js @@ -10,13 +10,13 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; -const processColor = require('processColor'); +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; function processColorObject( color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { + const processColor = require('processColor'); const dynamic = color.dynamic; const dynamicColor: NativeOrDynamicColorType = { dynamic: { diff --git a/Libraries/StyleSheet/processColorObject.macos.js b/Libraries/StyleSheet/processColorObject.macos.js index bfb86980754bd7..f5dedc8e947688 100644 --- a/Libraries/StyleSheet/processColorObject.macos.js +++ b/Libraries/StyleSheet/processColorObject.macos.js @@ -10,13 +10,13 @@ // [TODO(macOS ISS#2323203) 'use strict'; -import type {NativeOrDynamicColorType} from 'normalizeColorObject'; -const processColor = require('processColor'); +import type {NativeOrDynamicColorType} from 'NativeOrDynamicColorType'; function processColorObject( color: NativeOrDynamicColorType, ): ?NativeOrDynamicColorType { if ('dynamic' in color && color.dynamic !== undefined) { + const processColor = require('processColor'); const dynamic = color.dynamic; const dynamicColor: NativeOrDynamicColorType = { dynamic: {