Skip to content

Commit 7c94a70

Browse files
committed
fix: isloading pointer issue
1 parent e13babd commit 7c94a70

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/components/primitives/Button/Button.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ const Button = (
102102
<Spinner color={_text?.color} {..._spinner} />
103103
);
104104

105+
const boxChildren = (child: any) => {
106+
return <Box _text={_text}>{child}</Box>;
107+
};
108+
105109
return (
106110
<Pressable
107111
disabled={isDisabled || isLoading}
@@ -125,12 +129,15 @@ const Button = (
125129
{...resolvedProps}
126130
accessibilityRole={props.accessibilityRole ?? 'button'}
127131
>
128-
<HStack {..._stack} space={isLoading && !isLoadingText ? 0 : 2}>
132+
<HStack {..._stack} test={true}>
129133
{startIcon && !isLoading ? startIcon : null}
130134
{isLoading && spinnerPlacement === 'start' ? spinnerElement : null}
131-
<Box _text={_text}>
132-
{isLoading ? (isLoadingText ? isLoadingText : null) : children}
133-
</Box>
135+
{isLoading
136+
? isLoadingText
137+
? boxChildren(isLoadingText)
138+
: null
139+
: boxChildren(children)}
140+
134141
{endIcon && !isLoading ? endIcon : null}
135142
{isLoading && spinnerPlacement === 'end' ? spinnerElement : null}
136143
</HStack>

src/theme/components/button.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ const baseStyle = (props: any) => {
1717
flexDirection: 'row',
1818
justifyContent: 'center',
1919
alignItems: 'center',
20+
2021
_web: {
21-
cursor: props.isDisabled
22-
? 'not-allowed'
23-
: props.isLoading
24-
? 'default'
25-
: 'pointer',
22+
_disabled: {
23+
cursor: 'not-allowed',
24+
},
25+
_loading: {
26+
cursor: 'not-allowed',
27+
},
28+
cursor: 'pointer',
2629
},
2730
_text: {
2831
fontWeight: 'medium',

0 commit comments

Comments
 (0)