React-Native-Document-Picker, how to access file photo in ios w/ that?

Viewed 16

im using react-native-document-picker but have problem on IOS. i cant open photo files. is there anyone ever face this issue ? and how to resolve this. please advise. below here is my code :

      handleSuffixIcon={async () => {
        try {
          const pickerResult = await DocumentPicker.pickSingle({
            presentationStyle: 'fullScreen',
            copyTo: 'documentDirectory',
            type:
              Platform.OS === 'ios'
                ? ['public.jpeg', 'public.png', 'com.adobe.pdf']
                : ['image/png', 'image/jpeg', 'application/pdf'],
          });

          if (pickerResult?.size <= 5000000) {
            setSizeMsg('');
            setUri(pickerResult?.fileCopyUri);
            setDocument(pickerResult?.name);
            setSize(pickerResult?.size);
            setType(pickerResult?.type);
          } else {
            setUri('');
            setDocument('');
            setType('');
            setSizeMsg({ error: trans(locale, lang, 'sizeToLarge') });
          }
        } catch (e) {
          // eslint-disable-next-line no-console
          console.log('error : ', e);
        }
      }}

my goals is to add more option like photo files. because in my project i have to send an image which is PNG/JPEG but also a document. and because i cant access my photo files. it really messy :(

enter image description here

0 Answers
Related