From a69f600787dc7ff080f7539f4dfc4b8be3b770dc Mon Sep 17 00:00:00 2001 From: Mark Lawlor Date: Sun, 8 May 2022 22:05:28 +1000 Subject: [PATCH] fix: rendering nested child styled components --- src/{styled.ts => styled.tsx} | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) rename src/{styled.ts => styled.tsx} (81%) diff --git a/src/styled.ts b/src/styled.tsx similarity index 81% rename from src/styled.ts rename to src/styled.tsx index 0edd843..6d8dd55 100644 --- a/src/styled.ts +++ b/src/styled.tsx @@ -2,8 +2,6 @@ import { createElement, FunctionComponent, ComponentClass } from "react"; import { ImageStyle, StyleProp, TextStyle, ViewStyle } from "react-native"; import { useTailwind } from "./use-tailwind"; -const isStyled = Symbol("styled"); - type StyledProps

= P & { className?: string; tw?: string; @@ -36,25 +34,17 @@ export function styled

( }`; } - Styled[isStyled] = true; - return Styled; } type StyledComponentProps

= StyledProps

& { - component: Component

& { - [isStyled]?: boolean; - }; + component: Component

; }; export function StyledComponent

({ component, ...options }: StyledComponentProps

) { - if (component[isStyled]) { - return component; - } - - return styled

(component)(options as P); + const Component = styled

(component); + return ; } -StyledComponent[isStyled] = true;