Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
15fae481
Commit
15fae481
authored
Sep 09, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a loading props to the button component
parent
d4bc002f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
Button.tsx
src/components/Button.tsx
+16
-4
No files found.
src/components/Button.tsx
View file @
15fae481
import
type
{
BoxProps
,
VariantProps
}
from
"@shopify/restyle"
;
import
type
{
BoxProps
,
VariantProps
}
from
"@shopify/restyle"
;
import
type
{
Theme
}
from
"@themes/Theme"
;
import
type
{
Theme
}
from
"@themes/Theme"
;
import
{
TouchableOpacity
}
from
"react-native"
;
import
{
ActivityIndicator
,
TouchableOpacity
}
from
"react-native"
;
import
ButtonBase
from
"./bases/ButtonBase"
;
import
ButtonBase
from
"./bases/ButtonBase"
;
import
Text
from
"./bases/Text"
;
import
Text
from
"./bases/Text"
;
...
@@ -9,13 +9,25 @@ type Props = BoxProps<Theme> &
...
@@ -9,13 +9,25 @@ type Props = BoxProps<Theme> &
VariantProps
<
Theme
,
"textVariants"
,
"textVariants"
>
&
{
VariantProps
<
Theme
,
"textVariants"
,
"textVariants"
>
&
{
label
:
string
;
label
:
string
;
onPress
:
()
=>
void
;
onPress
:
()
=>
void
;
isLoading
?:
boolean
;
};
};
const
Button
=
({
onPress
,
label
,
textVariants
,
variant
,
...
rest
}:
Props
)
=>
{
const
Button
=
({
onPress
,
label
,
isLoading
,
textVariants
,
variant
,
...
rest
}:
Props
)
=>
{
return
(
return
(
<
TouchableOpacity
onPress=
{
onPress
}
>
<
TouchableOpacity
onPress=
{
onPress
}
>
<
ButtonBase
variant=
{
variant
}
justifyContent=
"center"
alignItems=
"center"
{
...
rest
}
>
<
ButtonBase
<
Text
variant=
{
textVariants
}
>
{
label
}
</
Text
>
variant=
{
variant
}
justifyContent=
"center"
alignItems=
"center"
flexDirection=
{
"row"
}
{
...
rest
}
gap=
{
"m"
}
>
{
isLoading
?
(
<
ActivityIndicator
color=
"white"
/>
)
:
(
<
Text
variant=
{
textVariants
}
>
{
label
}
</
Text
>
)
}
</
ButtonBase
>
</
ButtonBase
>
</
TouchableOpacity
>
</
TouchableOpacity
>
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment