mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
dc3355920d
Summary: ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - Rename normalize-color to normalize-colors as part of https://github.com/react-native-community/discussions-and-proposals/pull/480 Pull Request resolved: https://github.com/facebook/react-native/pull/34571 Reviewed By: cortinico Differential Revision: D39235696 Pulled By: hoxyq fbshipit-source-id: b6d5fcae9fb5c953c2f7b48f73a95cd883ff8f63
35 lines
904 B
JavaScript
Executable File
35 lines
904 B
JavaScript
Executable File
/**
|
|
* Copyright (c) Meta Platforms, Inc. and 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
|
|
*/
|
|
|
|
/* eslint no-bitwise: 0 */
|
|
|
|
import type {ProcessedColorValue} from './processColor';
|
|
import type {ColorValue} from './StyleSheet';
|
|
|
|
import _normalizeColor from '@react-native/normalize-colors';
|
|
|
|
function normalizeColor(
|
|
color: ?(ColorValue | ProcessedColorValue),
|
|
): ?ProcessedColorValue {
|
|
if (typeof color === 'object' && color != null) {
|
|
const {normalizeColorObject} = require('./PlatformColorValueTypes');
|
|
const normalizedColor = normalizeColorObject(color);
|
|
if (normalizedColor != null) {
|
|
return normalizedColor;
|
|
}
|
|
}
|
|
|
|
if (typeof color === 'string' || typeof color === 'number') {
|
|
return _normalizeColor(color);
|
|
}
|
|
}
|
|
|
|
module.exports = normalizeColor;
|