Skip to content

Commit

Permalink
Set snackbar offset to 0 for screens where there is no bottom navigat…
Browse files Browse the repository at this point in the history
…ion bar
  • Loading branch information
oddballdave committed Dec 10, 2024
1 parent ad853bb commit 6b3d569
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function AskForClaimDecision({ navigation, route }: AskForClaimDecisionProps) {
setSubmittedDecision(true)
snackbar.show('Request sent')
},
onError: () => snackbar.show('Request could not be sent', { isError: true, onActionPressed: () => onSubmit }),
onError: () =>
snackbar.show('Request could not be sent', { isError: true, offset: 0, onActionPressed: () => onSubmit }),
}
submitClaimDecision(claimID, mutateOptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ function UploadFile({ navigation, route }: UploadFileProps) {
snackbar.show(t('fileUpload.submitted'))
},
onError: () =>
snackbar.show(t('fileUpload.submitted.error'), { isError: true, onActionPressed: onUploadConfirmed }),
snackbar.show(t('fileUpload.submitted.error'), {
isError: true,
offset: 0,
onActionPressed: onUploadConfirmed,
}),
}
const params: UploadFileToClaimParamaters = { claimID, documentType: documentType, request, files: filesList }
uploadFileToClaim(params, mutateOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ function UploadOrAddPhotos({ navigation, route }: UploadOrAddPhotosProps) {
snackbar.show(t('fileUpload.submitted'))
},
onError: () =>
snackbar.show(t('fileUpload.submitted.error'), { isError: true, onActionPressed: onUploadConfirmed }),
snackbar.show(t('fileUpload.submitted.error'), {
isError: true,
offset: 0,
onActionPressed: onUploadConfirmed,
}),
}
const params: UploadFileToClaimParamaters = {
claimID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function useComposeCancelConfirmation(): [
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
onActionPressed: () => saveDraft(params, mutateOptions),
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
const params: SendMessageParameters = { messageData: messageData, uploads: attachmentsList }
snackbar.show(t('secureMessaging.startNewMessage.sent.error'), {
isError: true,
offset: 0,
onActionPressed: () => sendMessage(params, mutateOptions),
})
}
Expand Down Expand Up @@ -271,6 +272,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
onError: () => {
snackbar.show(t('secureMessaging.deleteDraft.snackBarErrorMessage'), {
isError: true,
offset: 0,
onActionPressed: () => deleteDraft(params, mutateOptions),
})
},
Expand Down Expand Up @@ -478,6 +480,7 @@ function EditDraft({ navigation, route }: EditDraftProps) {
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
onActionPressed: () => saveDraft(params, mutateOptions),
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ function ReplyMessage({ navigation, route }: ReplyMessageProps) {
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
onActionPressed: () =>
saveDraft(
{
Expand Down Expand Up @@ -253,6 +254,7 @@ function ReplyMessage({ navigation, route }: ReplyMessageProps) {
} else {
snackbar.show(t('secureMessaging.startNewMessage.sent.error'), {
isError: true,
offset: 0,
onActionPressed: () =>
sendMessage(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
onError: () => {
snackbar.show(t('secureMessaging.draft.saved.error'), {
isError: true,
offset: 0,
onActionPressed: () => {
// passing messageDataRef to ensure we have the latest messageData
saveDraft({ messageData: messageDataRef.current }, mutateOptions)
Expand All @@ -332,6 +333,7 @@ function StartNewMessage({ navigation, route }: StartNewMessageProps) {
} else {
snackbar.show(t('secureMessaging.startNewMessage.sent.error'), {
isError: true,
offset: 0,
onActionPressed: () => {
// passing messageDataRef to ensure we have the latest messageData
sendMessage({ messageData: messageDataRef.current, uploads: attachmentsList }, mutateOptions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function AddressValidation({
const mutateOptions = {
onSuccess: () => snackbar.show(GenerateAddressMessage(t, addressType, false)),
onError: () =>
snackbar.show(GenerateAddressMessage(t, addressType, true), { isError: true, onActionPressed: () => save }),
snackbar.show(GenerateAddressMessage(t, addressType, true), {
isError: true,
offset: 0,
onActionPressed: () => save,
}),
}
saveAddress({ addressData, revalidate }, mutateOptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ function EditAddressScreen({ navigation, route }: IEditAddressScreen) {
onError: () =>
snackbar.show(t('contactInformation.residentialAddress.removed.error'), {
isError: true,
offset: 0,
onActionPressed: () => deleteAddress,
}),
}
Expand Down Expand Up @@ -274,7 +275,11 @@ function EditAddressScreen({ navigation, route }: IEditAddressScreen) {
}
},
onError: () =>
snackbar.show(GenerateAddressMessage(t, addressType, true), { isError: true, onActionPressed: () => save }),
snackbar.show(GenerateAddressMessage(t, addressType, true), {
isError: true,
offset: 0,
onActionPressed: () => save,
}),
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ function EditEmailScreen({ navigation }: EditEmailScreenProps) {
onError: (error: unknown) => {
if (isErrorObject(error)) {
if (error.status === 400) {
snackbar.show(t('contactInformation.emailAddress.not.saved'), { isError: true })
snackbar.show(t('contactInformation.emailAddress.not.saved'), { isError: true, offset: 0 })
} else {
snackbar.show(t('contactInformation.emailAddress.not.saved'), {
isError: true,
offset: 0,
onActionPressed: () => saveEmail(emailData, mutateOptions),
})
}
Expand Down Expand Up @@ -130,6 +131,7 @@ function EditEmailScreen({ navigation }: EditEmailScreenProps) {
onError: () =>
snackbar.show(t('contactInformation.emailAddress.not.removed'), {
isError: true,
offset: 0,
onActionPressed: () => deleteEmail(emailData, mutateOptions),
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function EditPhoneNumberScreen({ navigation, route }: IEditPhoneNumberScreen) {
isErrorObject(error) &&
snackbar.show(t('contactInformation.phoneNumber.not.saved', { type: displayTitle }), {
isError: true,
offset: 0,
onActionPressed: save,
}),
}
Expand All @@ -147,6 +148,7 @@ function EditPhoneNumberScreen({ navigation, route }: IEditPhoneNumberScreen) {
isErrorObject(error) &&
snackbar.show(t('contactInformation.phoneNumber.not.removed', { type: displayTitle }), {
isError: true,
offset: 0,
onActionPressed: () => deletePhoneNumber(phoneData, mutateOptions),
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function GenderIdentityScreen({ navigation }: GenderIdentityScreenProps) {
onError: () =>
snackbar.show(t('personalInformation.genderIdentity.not.saved'), {
isError: true,
offset: 0,
onActionPressed: updateGenderIdentity,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function PreferredNameScreen({ navigation }: PreferredNameScreenProps) {
onError: () =>
snackbar.show(t('personalInformation.preferredName.notSaved'), {
isError: true,
offset: 0,
onActionPressed: updatePreferredName,
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function EditDirectDepositScreen({ navigation, route }: EditDirectDepositProps)
if (!routingNumberError) {
snackbar.show(t('directDeposit.saved.error'), {
isError: true,
offset: 0,
onActionPressed: () => updateBankInfo(updateBankData, mutateOptions),
})
}
Expand Down

0 comments on commit 6b3d569

Please sign in to comment.