Rename BoxShadowPrimitive to BoxShadowValue (#46485)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46485

Keep the type naming consistent with examples like `DimensionValue`, `ColorValue`, etc.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D62614444

fbshipit-source-id: 3ff66d3f52623b6fb7bd8d31d2910aa255ae8a31
This commit is contained in:
Jorge Cabiedes Acosta
2024-09-16 15:40:50 +02:00
committed by Riccardo Cipolleschi
parent 123b25226a
commit fdb5721ead
5 changed files with 12 additions and 16 deletions
@@ -248,7 +248,7 @@ export type DropShadowPrimitive = {
color?: ColorValue | number | undefined;
};
export type BoxShadowPrimitive = {
export type BoxShadowValue = {
offsetX: number | string;
offsetY: number | string;
color?: string | undefined;
@@ -336,7 +336,7 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
isolation?: 'auto' | 'isolate' | undefined;
cursor?: CursorValue | undefined;
boxShadow?: ReadonlyArray<BoxShadowPrimitive> | string | undefined;
boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined;
filter?: ReadonlyArray<FilterFunction> | string | undefined;
}
@@ -719,7 +719,7 @@ export type GradientValue = {
}>,
};
export type BoxShadowPrimitive = {
export type BoxShadowValue = {
offsetX: number | string,
offsetY: number | string,
color?: ____ColorValue_Internal,
@@ -788,7 +788,7 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
elevation?: number,
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
cursor?: CursorValue,
boxShadow?: $ReadOnlyArray<BoxShadowPrimitive> | string,
boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
filter?: $ReadOnlyArray<FilterFunction> | string,
experimental_mixBlendMode?: ____BlendMode_Internal,
experimental_backgroundImage?: $ReadOnlyArray<GradientValue> | string,
@@ -10,7 +10,7 @@
*/
import type {ProcessedColorValue} from './processColor';
import type {BoxShadowPrimitive} from './StyleSheetTypes';
import type {BoxShadowValue} from './StyleSheetTypes';
import processColor from './processColor';
@@ -24,7 +24,7 @@ export type ParsedBoxShadow = {
};
export default function processBoxShadow(
rawBoxShadows: ?($ReadOnlyArray<BoxShadowPrimitive> | string),
rawBoxShadows: ?($ReadOnlyArray<BoxShadowValue> | string),
): Array<ParsedBoxShadow> {
const result: Array<ParsedBoxShadow> = [];
if (rawBoxShadows == null) {
@@ -106,16 +106,14 @@ export default function processBoxShadow(
return result;
}
function parseBoxShadowString(
rawBoxShadows: string,
): Array<BoxShadowPrimitive> {
let result: Array<BoxShadowPrimitive> = [];
function parseBoxShadowString(rawBoxShadows: string): Array<BoxShadowValue> {
let result: Array<BoxShadowValue> = [];
for (const rawBoxShadow of rawBoxShadows
.split(/,(?![^()]*\))/) // split by comma that is not in parenthesis
.map(bS => bS.trim())
.filter(bS => bS !== '')) {
const boxShadow: BoxShadowPrimitive = {
const boxShadow: BoxShadowValue = {
offsetX: 0,
offsetY: 0,
};
@@ -8247,7 +8247,7 @@ export type GradientValue = {
positions?: $ReadOnlyArray<string>,
}>,
};
export type BoxShadowPrimitive = {
export type BoxShadowValue = {
offsetX: number | string,
offsetY: number | string,
color?: ____ColorValue_Internal,
@@ -8314,7 +8314,7 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
elevation?: number,
pointerEvents?: \\"auto\\" | \\"none\\" | \\"box-none\\" | \\"box-only\\",
cursor?: CursorValue,
boxShadow?: $ReadOnlyArray<BoxShadowPrimitive> | string,
boxShadow?: $ReadOnlyArray<BoxShadowValue> | string,
filter?: $ReadOnlyArray<FilterFunction> | string,
experimental_mixBlendMode?: ____BlendMode_Internal,
experimental_backgroundImage?: $ReadOnlyArray<GradientValue> | string,
@@ -8586,7 +8586,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/proce
inset?: boolean,
};
declare export default function processBoxShadow(
rawBoxShadows: ?($ReadOnlyArray<BoxShadowPrimitive> | string)
rawBoxShadows: ?($ReadOnlyArray<BoxShadowValue> | string)
): Array<ParsedBoxShadow>;
"
`;
-2
View File
@@ -35,9 +35,7 @@
import {
GradientValue,
BlendMode,
BoxShadowPrimitive,
DimensionValue,
FilterFunction,
} from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
export {};