System share sheet functionality for React Native apps using expo-sharing with automatic MIME type detection.
npm install @umituz/react-native-sharingreact>= 18.2.0react-native>= 0.74.0expo-sharing~6.0.3
- ✅ Share files via system share sheet
- ✅ Automatic MIME type detection
- ✅ Platform-specific options (UTI for iOS, dialogTitle for Android)
- ✅ Share availability check
- ✅ Multiple file sharing (sequential)
- ✅ Type-safe share operations
import { useSharing } from '@umituz/react-native-sharing';
const { share, isAvailable, isSharing } = useSharing();
if (!isAvailable) {
return <Text>Sharing not available</Text>;
}
const handleShare = async () => {
const success = await share('file:///path/to/file.jpg', {
dialogTitle: 'Share Photo',
mimeType: 'image/jpeg',
});
if (success) {
console.log('Shared successfully');
}
};import { useSharing } from '@umituz/react-native-sharing';
const { shareWithAutoType } = useSharing();
// MIME type auto-detected from .pdf extension
await shareWithAutoType(
'file:///path/to/document.pdf',
'document.pdf',
'Share Document'
);import { useSharing } from '@umituz/react-native-sharing';
const { shareMultiple } = useSharing();
const handleShareMultiple = async () => {
const uris = [
'file:///path/to/file1.jpg',
'file:///path/to/file2.jpg',
'file:///path/to/file3.jpg',
];
await shareMultiple(uris, {
dialogTitle: 'Share Photos',
mimeType: 'image/jpeg',
});
};import { SharingUtils, MIME_TYPES } from '@umituz/react-native-sharing';
// Get MIME type from extension
const mimeType = SharingUtils.getMimeTypeFromExtension('document.pdf');
// Returns: 'application/pdf'
// Get UTI for iOS
const uti = SharingUtils.getUTIFromExtension('photo.jpg');
// Returns: 'public.jpeg'useSharing(): Main hook for sharing functionality
SharingService: Direct service access for sharing operations
SharingUtils: Utility functions for MIME type detection and options preparationMIME_TYPES: Predefined MIME type constantsUTI_TYPES: iOS UTI type constants
MIT