Skip to content

Commit

Permalink
Added loadingIndicator size prop to ButtonBase component
Browse files Browse the repository at this point in the history
  • Loading branch information
Canciller committed Aug 11, 2022
1 parent b568370 commit 2e8b15f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ReactNode, useRef } from 'react';
import {
ActivityIndicator,
ActivityIndicatorProps,
Animated,
GestureResponderEvent,
Platform,
Expand Down Expand Up @@ -53,6 +54,7 @@ export interface ButtonBaseProps extends PressableProps {
marginTop?: number;
marginBottom?: number;
flex?: number;
loadingIndicatorSize?: ActivityIndicatorProps['size'];
}

export function ButtonBase({
Expand All @@ -77,6 +79,7 @@ export function ButtonBase({
marginBottom,
marginTop,
flex,
loadingIndicatorSize = 'large',
...props
}: ButtonBaseProps) {
const animated = useRef(new Animated.Value(0)).current;
Expand Down Expand Up @@ -166,7 +169,10 @@ export function ButtonBase({
) : null}
{loading ? (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color={styles.loading.color} />
<ActivityIndicator
size={loadingIndicatorSize}
color={styles.loading.color}
/>
</View>
) : null}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function IconButton({
height={size}
variant={variant}
transparent={transparent}
loadingIndicatorSize={size}
{...props}
>
{children}
Expand Down

0 comments on commit 2e8b15f

Please sign in to comment.