import * as DocumentPicker from 'expo-document-picker'; import React from 'react'; import { Alert, Image, Platform, Text, View } from 'react-native'; import Button from '../components/Button'; import TitleSwitch from '../components/TitledSwitch'; export default function DocumentPickerScreen() { const [copyToCache, setCopyToCache] = React.useState(false); const [document, setDocument] = React.useState(null); const openPicker = async () => { const time = Date.now(); const result = await DocumentPicker.getDocumentAsync({ copyToCacheDirectory: copyToCache, }); console.log(`Duration: ${Date.now() - time}ms`); console.log(`Results:`, result); if (result.type === 'success') { setDocument(result); } else { setTimeout(() => { if (Platform.OS === 'web') { alert('Cancelled'); } else { Alert.alert('Cancelled'); } }, 100); } }; return (