diff --git a/frontend/src/components/ShareButtons.tsx b/frontend/src/components/ShareButtons.tsx index 1ccc5de..f131b25 100644 --- a/frontend/src/components/ShareButtons.tsx +++ b/frontend/src/components/ShareButtons.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useLanguage } from '@/context/LanguageContext'; import { ShareIcon, @@ -18,6 +18,12 @@ interface ShareButtonsProps { export default function ShareButtons({ title, url, description }: ShareButtonsProps) { const { locale } = useLanguage(); const [copied, setCopied] = useState(false); + const [supportsNativeShare, setSupportsNativeShare] = useState(false); + + // Check for native share support only after mount to avoid hydration mismatch + useEffect(() => { + setSupportsNativeShare(typeof navigator !== 'undefined' && typeof navigator.share === 'function'); + }, []); // Use provided URL or current page URL const shareUrl = url || (typeof window !== 'undefined' ? window.location.href : ''); @@ -133,7 +139,7 @@ export default function ShareButtons({ title, url, description }: ShareButtonsPr {/* Native Share (mobile) */} - {typeof navigator !== 'undefined' && typeof navigator.share === 'function' && ( + {supportsNativeShare && (