blob: c51eb332e729e360f5b029e967f66b127f5d2969 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { ActivityIndicator, Pressable, PressableProps } from "react-native";
export function ActionButton({
children,
loading,
disabled,
...props
}: PressableProps & {
loading: boolean;
}) {
if (disabled !== undefined) {
disabled ||= loading;
} else if (loading) {
disabled = true;
}
return (
<Pressable {...props} disabled={disabled}>
{loading ? <ActivityIndicator /> : children}
</Pressable>
);
}
|