diff --git a/src/components/TopUpModal.tsx b/src/components/TopUpModal.tsx
index a52ddd8..4bf5d16 100644
--- a/src/components/TopUpModal.tsx
+++ b/src/components/TopUpModal.tsx
@@ -258,7 +258,8 @@ export default function TopUpModal({ method, onClose, initialAmountRubles }: Top
// Calculate display amount for preview
const displayAmount = amount && parseFloat(amount) > 0 ? parseFloat(amount) : 0
- const renderContent = () => (
+ // Content JSX - shared between mobile and desktop
+ const contentJSX = (
{/* Header icon and method */}
@@ -403,8 +404,8 @@ export default function TopUpModal({ method, onClose, initialAmountRubles }: Top
)
- // Mobile bottom sheet
- const MobileModal = () => (
+ // Render modal based on screen size - NO nested components!
+ const modalContent = isMobileScreen ? (
<>
{/* Backdrop */}
- {renderContent()}
+ {contentJSX}
>
- )
-
- // Desktop modal - positioned higher
- const DesktopModal = () => (
+ ) : (
- {renderContent()}
+ {contentJSX}
)
- const content = isMobileScreen ? :
-
if (typeof document !== 'undefined') {
- return createPortal(content, document.body)
+ return createPortal(modalContent, document.body)
}
- return content
+ return modalContent
}