Files
react-native/Libraries/StyleSheet/normalizeColor.js
T
Thibault Malbranche dc3355920d chore: rename normalize-color to normalize-colors (umbrella 480) (#34571)
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
2022-12-01 08:46:57 -08:00

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;