From c827c226ef79187793300ab4a969749f1bebc464 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Wed, 13 Sep 2023 09:59:59 +0530 Subject: [PATCH] fix unnamed component lint error --- src/lib/design-system/index.tsx | 79 ++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/src/lib/design-system/index.tsx b/src/lib/design-system/index.tsx index c8b7d5716d..c35dd317df 100644 --- a/src/lib/design-system/index.tsx +++ b/src/lib/design-system/index.tsx @@ -77,19 +77,20 @@ export function useStyles(props: Props & T) { return {styles, props: rest} } -export const Box = React.forwardRef>( - ({children, style, ...props}, ref) => { - const {styles, props: rest} = useStyles(props) - return ( - - {children} - - ) - }, -) +export const Box = React.forwardRef>(function BoxThemed( + {children, style, ...props}, + ref, +) { + const {styles, props: rest} = useStyles(props) + return ( + + {children} + + ) +}) export const Text = React.forwardRef>( - ({children, style, ...props}, ref) => { + function TextThemed({children, style, ...props}, ref) { const {styles, props: rest} = useStyles({ color: 'text', ...props, @@ -144,7 +145,10 @@ const asToTypeStyles: { }, } -export const P = React.forwardRef((props, ref) => { +export const P = React.forwardRef(function PThemed( + props, + ref, +) { // @ts-expect-error role is web only return }) @@ -154,32 +158,33 @@ export const P = React.forwardRef((props, ref) => { * @see https://docs.expo.dev/develop/user-interface/fonts/ */ function createHeadingComponent(element: HeadingElements) { - return React.forwardRef( - ({children, style, as, ...props}, ref) => { - const asEl = as || element - const extra = Platform.select({ - web: { - 'aria-level': asToAriaLevel[element], - }, - default: {}, - }) - const {styles, props: rest} = useStyles({ - color: 'text', - ...merge(asToTypeStyles[asEl], props), - }) + return React.forwardRef(function HeadingThemed( + {children, style, as, ...props}, + ref, + ) { + const asEl = as || element + const extra = Platform.select({ + web: { + 'aria-level': asToAriaLevel[element], + }, + default: {}, + }) + const {styles, props: rest} = useStyles({ + color: 'text', + ...merge(asToTypeStyles[asEl], props), + }) - return ( - - {children} - - ) - }, - ) + return ( + + {children} + + ) + }) } export const H1 = createHeadingComponent('h1')