File tree Expand file tree Collapse file tree 4 files changed +30
-36
lines changed
starter-kit-expo/components/ui
starter-kit-next/components/ui Expand file tree Collapse file tree 4 files changed +30
-36
lines changed Original file line number Diff line number Diff line change 11'use client' ;
2- import React from 'react' ;
2+ import React , { useMemo } from 'react' ;
33import { Text , View } from 'react-native' ;
44import { PrimitiveIcon , UIIcon } from '@gluestack-ui/core/icon/creator' ;
55import { tva } from '@gluestack-ui/utils/nativewind-utils' ;
@@ -120,15 +120,17 @@ function Badge({
120120 className,
121121 ...props
122122} : { className ?: string } & IBadgeProps ) {
123+
124+ const contextValue = useMemo (
125+ ( ) => ( { action, variant, size } ) ,
126+ [ action , variant , size ]
127+ ) ;
128+
123129 return (
124130 < ContextView
125131 className = { badgeStyle ( { action, variant, class : className } ) }
126132 { ...props }
127- context = { {
128- action,
129- variant,
130- size,
131- } }
133+ context = { contextValue }
132134 >
133135 { children }
134136 </ ContextView >
@@ -211,4 +213,4 @@ Badge.displayName = 'Badge';
211213BadgeText . displayName = 'BadgeText' ;
212214BadgeIcon . displayName = 'BadgeIcon' ;
213215
214- export { Badge , BadgeIcon , BadgeText } ;
216+ export { Badge , BadgeIcon , BadgeText } ;
Original file line number Diff line number Diff line change 11'use client' ;
22import React from 'react' ;
33import { createButton } from '@gluestack-ui/core/button/creator' ;
4- import { tva } from '@gluestack-ui/utils/nativewind-utils' ;
54import {
5+ tva ,
66 withStyleContext ,
77 useStyleContext ,
8+ type VariantProps ,
89} from '@gluestack-ui/utils/nativewind-utils' ;
910import { cssInterop } from 'nativewind' ;
1011import { ActivityIndicator , Pressable , Text , View } from 'react-native' ;
11- import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils' ;
1212import { PrimitiveIcon , UIIcon } from '@gluestack-ui/core/icon/creator' ;
1313
1414const SCOPE = 'BUTTON' ;
@@ -326,14 +326,9 @@ const ButtonText = React.forwardRef<
326326 size : parentSize ,
327327 action : parentAction ,
328328 } ,
329- variant : variant as 'link' | 'outline' | 'solid' | undefined ,
329+ variant,
330330 size,
331- action : action as
332- | 'primary'
333- | 'secondary'
334- | 'positive'
335- | 'negative'
336- | undefined ,
331+ action,
337332 class : className ,
338333 } ) }
339334 />
@@ -420,8 +415,8 @@ const ButtonGroup = React.forwardRef<
420415 className = { buttonGroupStyle ( {
421416 class : className ,
422417 space,
423- isAttached : isAttached as boolean ,
424- flexDirection : flexDirection as any ,
418+ isAttached,
419+ flexDirection,
425420 } ) }
426421 { ...props }
427422 ref = { ref }
Original file line number Diff line number Diff line change 11'use client' ;
2- import React from 'react' ;
2+ import React , { useMemo } from 'react' ;
33import { Text , View } from 'react-native' ;
44import { PrimitiveIcon , UIIcon } from '@gluestack-ui/core/icon/creator' ;
55import { tva } from '@gluestack-ui/utils/nativewind-utils' ;
@@ -120,15 +120,17 @@ function Badge({
120120 className,
121121 ...props
122122} : { className ?: string } & IBadgeProps ) {
123+
124+ const contextValue = useMemo (
125+ ( ) => ( { action, variant, size } ) ,
126+ [ action , variant , size ]
127+ ) ;
128+
123129 return (
124130 < ContextView
125131 className = { badgeStyle ( { action, variant, class : className } ) }
126132 { ...props }
127- context = { {
128- action,
129- variant,
130- size,
131- } }
133+ context = { contextValue }
132134 >
133135 { children }
134136 </ ContextView >
@@ -211,4 +213,4 @@ Badge.displayName = 'Badge';
211213BadgeText . displayName = 'BadgeText' ;
212214BadgeIcon . displayName = 'BadgeIcon' ;
213215
214- export { Badge , BadgeIcon , BadgeText } ;
216+ export { Badge , BadgeIcon , BadgeText } ;
Original file line number Diff line number Diff line change 11'use client' ;
22import React from 'react' ;
33import { createButton } from '@gluestack-ui/core/button/creator' ;
4- import { tva } from '@gluestack-ui/utils/nativewind-utils' ;
54import {
5+ tva ,
66 withStyleContext ,
77 useStyleContext ,
8+ type VariantProps ,
89} from '@gluestack-ui/utils/nativewind-utils' ;
910import { cssInterop } from 'nativewind' ;
1011import { ActivityIndicator , Pressable , Text , View } from 'react-native' ;
11- import type { VariantProps } from 'tailwind-variants' ;
1212import { PrimitiveIcon , UIIcon } from '@gluestack-ui/core/icon/creator' ;
1313
1414const SCOPE = 'BUTTON' ;
@@ -326,14 +326,9 @@ const ButtonText = React.forwardRef<
326326 size : parentSize ,
327327 action : parentAction ,
328328 } ,
329- variant : variant as 'link' | 'outline' | 'solid' | undefined ,
329+ variant,
330330 size,
331- action : action as
332- | 'primary'
333- | 'secondary'
334- | 'positive'
335- | 'negative'
336- | undefined ,
331+ action,
337332 class : className ,
338333 } ) }
339334 />
@@ -420,8 +415,8 @@ const ButtonGroup = React.forwardRef<
420415 className = { buttonGroupStyle ( {
421416 class : className ,
422417 space,
423- isAttached : isAttached as boolean ,
424- flexDirection : flexDirection as any ,
418+ isAttached,
419+ flexDirection,
425420 } ) }
426421 { ...props }
427422 ref = { ref }
You can’t perform that action at this time.
0 commit comments