From f320d6212d1cba382219b73d4d2e8752e309bb32 Mon Sep 17 00:00:00 2001 From: Nicolas Torion Date: Fri, 8 Nov 2024 14:53:26 +0100 Subject: [PATCH] Fix on textShadowOffset prop --- package.json | 2 +- src/components/avatar/avatar.style.tsx | 12 ++++++++---- src/components/badge/badge.style.tsx | 12 ++++++++---- src/components/input/input.style.tsx | 12 ++++++++---- src/components/text/text.style.tsx | 12 ++++++++---- src/types.ts | 2 +- 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 0da318d..bc4dcf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-ficus-ui", - "version": "1.3.1", + "version": "1.3.2", "description": "React Native UI library forked from Magnus UI and inspired by Chakra UI", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/src/components/avatar/avatar.style.tsx b/src/components/avatar/avatar.style.tsx index 901fb04..beb5cd2 100644 --- a/src/components/avatar/avatar.style.tsx +++ b/src/components/avatar/avatar.style.tsx @@ -158,10 +158,14 @@ export const getStyle = (theme: ThemeType, props: AvatarProps) => { theme.colors, props.textShadowColor as string ), - textShadowOffset: { - width: getThemeProperty(theme.shadow, props.textShadowOffset), - height: getThemeProperty(theme.shadow, props.textShadowOffset), - }, + ...(props.textShadowOffset?.width || props.textShadowOffset?.height + ? { + textShadowOffset: { + width: props.textShadowOffset?.width, + height: props.textShadowOffset?.height, + }, + } + : {}), textShadowRadius: getThemeProperty( theme.borderRadius, props.textShadowRadius diff --git a/src/components/badge/badge.style.tsx b/src/components/badge/badge.style.tsx index d985d7a..495393d 100644 --- a/src/components/badge/badge.style.tsx +++ b/src/components/badge/badge.style.tsx @@ -134,10 +134,14 @@ export const getStyle = (theme: ThemeType, props: BadgeProps) => { theme.colors, props.textShadowColor as string ), - textShadowOffset: { - width: getThemeProperty(theme.shadow, props.textShadowOffset), - height: getThemeProperty(theme.shadow, props.textShadowOffset), - }, + ...(props.textShadowOffset?.width || props.textShadowOffset?.height + ? { + textShadowOffset: { + width: props.textShadowOffset?.width, + height: props.textShadowOffset?.height, + }, + } + : {}), textShadowRadius: getThemeProperty( theme.borderRadius, props.textShadowRadius diff --git a/src/components/input/input.style.tsx b/src/components/input/input.style.tsx index 63e37f4..c06d603 100644 --- a/src/components/input/input.style.tsx +++ b/src/components/input/input.style.tsx @@ -90,10 +90,14 @@ export const getStyle = (theme: ThemeType, props: InputProps, state: any) => { theme.colors, props.textShadowColor as string ), - textShadowOffset: { - width: getThemeProperty(theme.shadow, props.textShadowOffset), - height: getThemeProperty(theme.shadow, props.textShadowOffset), - }, + ...(props.textShadowOffset?.width || props.textShadowOffset?.height + ? { + textShadowOffset: { + width: props.textShadowOffset?.width, + height: props.textShadowOffset?.height, + }, + } + : {}), textShadowRadius: getThemeProperty( theme.borderRadius, props.textShadowRadius diff --git a/src/components/text/text.style.tsx b/src/components/text/text.style.tsx index 17a8494..b92883a 100644 --- a/src/components/text/text.style.tsx +++ b/src/components/text/text.style.tsx @@ -51,10 +51,14 @@ export const getStyle = (theme: ThemeType, props: TextProps) => { theme.colors, props.textShadowColor as string ), - textShadowOffset: { - width: getThemeProperty(theme.shadow, props.textShadowOffset), - height: getThemeProperty(theme.shadow, props.textShadowOffset), - }, + ...(props.textShadowOffset?.width || props.textShadowOffset?.height + ? { + textShadowOffset: { + width: props.textShadowOffset?.width, + height: props.textShadowOffset?.height, + }, + } + : {}), textShadowRadius: getThemeProperty( theme.borderRadius, props.textShadowRadius diff --git a/src/types.ts b/src/types.ts index be6e616..58034a4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -325,7 +325,7 @@ export interface TextPropsType { textDecorationColor?: ResponsiveValue; textShadowColor?: ResponsiveValue; textShadowOffset?: ResponsiveValue<{ width: number; height: number }>; - textShadowRadius?: ResponsiveValue; + textShadowRadius?: ResponsiveValue; } export const opacityProps = ['opacity'] as const;