React-native-document-picker: How do I access the photos?

Created on 27 Mar 2018  路  12Comments  路  Source: rnmods/react-native-document-picker

How to access the photos through the document picker?

All 12 comments

                  DocumentPicker.show({
                    filetype: [DocumentPickerUtil.images(),DocumentPickerUtil.plainText()],
                  }, (error, res) => {
                    // Android

                    console.log(
                      "Document Image Picker Response", res
                    );
// uploadable content
                    let file_obj = {
                      uri:res.uri,
                      type:res.type,
                      name:res.fileName,
                      size:res.fileSize
                    }
                    this.setState({picker_response:file_obj},()=>{
                      this.addExternalFile()
                    })
                  });

Not working on iOS at all :(

Same here can't access to local photos on iOS. iCloud Drive and Recently Deleted available only.

Using filetype: [DocumentPickerUtil.allFiles()] but still getting only iCloud Drive and Recently Deleted too.

have you given proper certificates to your IOS app

Besides this is there another place?

Just to be clear; In this image, for me it only show More ... option which list iCloud Drive and Recently Deleted, I also set the Capabilities > iCloud.

"react": "16.0.0-alpha.12"
"react-native": "^0.48.4"
"react-native-document-picker": "^2.1.0"

Working with v3 still the same, listing only the iCloud Drive

$ npm install git://github.com/Elyx0/react-native-document-picker.git#v3 --save
"react-native-document-picker": "git://github.com/Elyx0/react-native-document-picker.git#v3",
import DocumentPicker from 'react-native-document-picker'

// ...

try {
      const res = await DocumentPicker.pick({
        type: [DocumentPicker.types.allFiles]
      })
      // ...
    } catch ( err ) {
      if ( DocumentPicker.isCancel(err) ) {
        // User cancelled the picker, exit any dialogs or menus and move on
      } else {
        throw err
      }
    }
    return null
  }

Same here

Any news about this?

@dantman sorry to bother, but do you know how to deal with this issue?

@rochapablo Photos aren't my target right now, and I'm working on another project for now (why I wasn't able to publish v3). But if photos were my target and both iOS and Android offered photos through a different api than the document picker, then I would use a different library to interact with that part of the OS API. I would not expect the library that is just supposed to be a wrapper around the document picker API on both platforms to also hardcode handling for other platform APIs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cchumi picture Cchumi  路  3Comments

MuneebJS picture MuneebJS  路  5Comments

andrey-shostik picture andrey-shostik  路  9Comments

ShaubertIlya picture ShaubertIlya  路  6Comments

johuder33 picture johuder33  路  5Comments