Skip to content

Commit

Permalink
feat: added button export and added test
Browse files Browse the repository at this point in the history
  • Loading branch information
wootsbot committed Dec 23, 2023
1 parent 692cf91 commit 99a6bc5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/@blocks-unstyled/src/Button/ButtonLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { ButtonContext } from './ButtonContext';
import type { ButtonLabelProps } from './Button.types';

export function ButtonLabel({ nativeID: nativeIDProp, testID: testIDProp, style, ...others }: ButtonLabelProps) {
const { nativeID, testID, hideLabelOnLoading, disabled, accessibilityLanguage } = React.useContext(ButtonContext);
const { nativeID, testID, hideLabelOnLoading, loading, disabled, accessibilityLanguage } =
React.useContext(ButtonContext);

const finalNativeID = nativeIDProp || (nativeID ? `${nativeID}Indicator` : undefined);
const finalTestID = testIDProp || (testID ? `${testID}Indicator` : undefined);

if (hideLabelOnLoading) {
if (loading && hideLabelOnLoading) {
return null;
}

Expand Down

0 comments on commit 99a6bc5

Please sign in to comment.