From 0c4df48ba4e43ab0d429d2936287aae1f93b5bc2 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Sat, 27 Jul 2024 11:39:27 -0700 Subject: [PATCH] Expose string types for `boxShadow` and `filter` (#45685) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45685 We built these to be able to parse web style string values, but the types only allow object form, and the TypeScript type is wrong. Changelog: [Internal] Reviewed By: joevilches Differential Revision: D60263730 fbshipit-source-id: 7a6e93924a92e8e62346645cb4f8ab1a37dca34f --- .../react-native/Libraries/StyleSheet/StyleSheetTypes.js | 4 ++-- .../__tests__/__snapshots__/public-api-test.js.snap | 4 ++-- packages/react-native/types/experimental.d.ts | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js index 0f00224adff..2db5431fc56 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js @@ -778,8 +778,8 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{ elevation?: number, pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only', cursor?: CursorValue, - experimental_boxShadow?: $ReadOnlyArray, - experimental_filter?: $ReadOnlyArray, + experimental_boxShadow?: $ReadOnlyArray | string, + experimental_filter?: $ReadOnlyArray | string, experimental_mixBlendMode?: ____BlendMode_Internal, }>; diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index f741d6c4313..54bec2efcc7 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -8487,8 +8487,8 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{ elevation?: number, pointerEvents?: \\"auto\\" | \\"none\\" | \\"box-none\\" | \\"box-only\\", cursor?: CursorValue, - experimental_boxShadow?: $ReadOnlyArray, - experimental_filter?: $ReadOnlyArray, + experimental_boxShadow?: $ReadOnlyArray | string, + experimental_filter?: $ReadOnlyArray | string, experimental_mixBlendMode?: ____BlendMode_Internal, }>; export type ____ViewStyle_Internal = $ReadOnly<{ diff --git a/packages/react-native/types/experimental.d.ts b/packages/react-native/types/experimental.d.ts index deea3034b45..859252932a9 100644 --- a/packages/react-native/types/experimental.d.ts +++ b/packages/react-native/types/experimental.d.ts @@ -149,8 +149,11 @@ declare module '.' { } export interface ViewStyle { - experimental_boxShadow?: BoxShadowPrimitive | undefined; - experimental_filter?: ReadonlyArray | undefined; + experimental_boxShadow?: + | ReadonlyArray + | string + | undefined; + experimental_filter?: ReadonlyArray | string | undefined; experimental_mixBlendMode?: BlendMode | undefined; } }