Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add hideSubmitButton prop to templates #8844

Merged
merged 7 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ const TemplateConfirmation = ({
[approvalRequest, onConfirm, onCancel, colors],
);

const showActions =
!templatedValues.hideSubmitButton &&
matthewwalsh0 marked this conversation as resolved.
Show resolved Hide resolved
Boolean(
matthewwalsh0 marked this conversation as resolved.
Show resolved Hide resolved
templatedValues.onConfirm ||
onConfirm ||
templatedValues.onCancel ||
onCancel,
);

useEffect(() => {
// Handles the cancellation logic
const handleOnCancel = () => {
Expand Down Expand Up @@ -83,12 +92,14 @@ const TemplateConfirmation = ({
return (
<View style={styles.root}>
<TemplateRenderer sections={templatedValues.content} />
<View style={styles.actionContainer}>
<BottomSheetFooter
buttonsAlignment={ButtonsAlignment.Horizontal}
buttonPropsArray={buttons}
/>
</View>
{showActions && (
matthewwalsh0 marked this conversation as resolved.
Show resolved Hide resolved
<View style={styles.actionContainer}>
<BottomSheetFooter
buttonsAlignment={ButtonsAlignment.Horizontal}
buttonPropsArray={buttons}
/>
</View>
)}
</View>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ConfirmationTemplateValues {
onConfirm?: (opts?: AcceptOptions) => void;
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
onlyConfirmButton?: boolean;
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
loadingText?: string;
hideSubmitButton?: boolean;
}

export interface ConfirmationTemplate {
Expand Down Expand Up @@ -41,6 +42,7 @@ const ALLOWED_TEMPLATE_KEYS: string[] = [
'onConfirm',
'onlyConfirmButton',
'loadingText',
'hideSubmitButton',
];

export function getTemplateValues(
Expand Down
Loading