diff --git a/packages/mobile/src/components/drawer/NativeDrawer.tsx b/packages/mobile/src/components/drawer/NativeDrawer.tsx index 6532ca49cb7..56965fa5ce7 100644 --- a/packages/mobile/src/components/drawer/NativeDrawer.tsx +++ b/packages/mobile/src/components/drawer/NativeDrawer.tsx @@ -9,6 +9,7 @@ import type { DrawerProps } from './Drawer' import Drawer from './Drawer' type NativeDrawerProps = SetOptional & { + blockClose?: boolean drawerName: DrawerName } @@ -17,14 +18,20 @@ type NativeDrawerProps = SetOptional & { * opening and closing. */ export const NativeDrawer = (props: NativeDrawerProps) => { - const { drawerName, onClose: onCloseProp, ...other } = props + const { + blockClose = true, + drawerName, + onClose: onCloseProp, + ...other + } = props const { isOpen, onClose, onClosed, visibleState } = useDrawer(drawerName) const handleClose = useCallback(() => { + if (blockClose) return onCloseProp?.() onClose() - }, [onCloseProp, onClose]) + }, [blockClose, onCloseProp, onClose]) if (visibleState === false) return null diff --git a/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx b/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx index 905ebb05367..bb726951b58 100644 --- a/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx +++ b/packages/mobile/src/components/premium-track-purchase-drawer/PremiumTrackPurchaseDrawer.tsx @@ -4,16 +4,18 @@ import type { PurchasableTrackMetadata } from '@audius/common' import { PurchaseContentStage, formatPrice, + isContentPurchaseInProgress, isTrackPurchasable, payExtraAmountPresetValues, purchaseContentActions, + purchaseContentSelectors, statusIsNotFinalized, useGetTrackById, usePurchaseContentFormConfiguration } from '@audius/common' import { Formik, useFormikContext } from 'formik' import { Linking, View, ScrollView, TouchableOpacity } from 'react-native' -import { useDispatch } from 'react-redux' +import { useDispatch, useSelector } from 'react-redux' import { toFormikValidationSchema } from 'zod-formik-adapter' import IconCart from 'app/assets/images/iconCart.svg' @@ -35,6 +37,9 @@ import { PurchaseSuccess } from './PurchaseSuccess' import { PurchaseSummaryTable } from './PurchaseSummaryTable' import { usePurchaseContentFormState } from './hooks/usePurchaseContentFormState' +const { getPurchaseContentFlowStage, getPurchaseContentError } = + purchaseContentSelectors + const PREMIUM_TRACK_PURCHASE_MODAL_NAME = 'PremiumTrackPurchase' const messages = { @@ -188,7 +193,9 @@ const RenderForm = ({ track }: { track: PurchasableTrackMetadata }) => { <> - + {isPurchaseSuccessful ? null : ( + + )} { )} - - {error ? ( - - - - {messages.error} - - - ) : null} -