import { Button } from '@/components/ui/button'; import { useShare } from '@/components/ui/share'; import { Text } from '@/components/ui/text'; import { View } from '@/components/ui/view'; import React, { useState } from 'react'; export function ShareHook() { const { shareText, shareUrl, shareContent } = useShare(); const [status, setStatus] = useState('Choose a sharing method'); const handleShareText = async () => { try { setStatus('Sharing text...'); await shareText( 'Hello from the useShare hook! This is just a plain text message.' ); setStatus('Text shared successfully!'); } catch (error) { setStatus(`Failed to share text: ${(error as Error).message}`); } }; const handleShareUrl = async () => { try { setStatus('Sharing URL...'); await shareUrl( 'https://reactnative.dev', 'Check out the official React Native documentation!' ); setStatus('URL shared successfully!'); } catch (error) { setStatus(`Failed to share URL: ${(error as Error).message}`); } }; const handleShareContent = async () => { try { setStatus('Sharing content...'); await shareContent({ message: '🚀 Just built an amazing React Native app with this component library!', url: 'https://github.com/example/ui-library', title: 'Amazing UI Library', subject: 'Check out this UI library', }); setStatus('Content shared successfully!'); } catch (error) { setStatus(`Failed to share content: ${(error as Error).message}`); } }; return ( {status} ); }