react-native-document-picker is not working on Android

Created on 25 Mar 2019  路  9Comments  路  Source: rnmods/react-native-document-picker

Performed all linking as per the READ ME

Added an entry in build.gradle

dependencies {
  implementation project(':react-native-document-picker')
}


And also on Settings.gradle

include ':react-native-document-picker'
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android')

Also provided permissions for

Works properly on iOS but fails on Android. Any help is really appreciated.

Screen Shot 2019-03-24 at 9 09 17 PM

Most helpful comment

Fixed the issue , had forgot to add entry new ReactNativeDocumentPicker()
in MainApplication get Packages()

It works now..

All 9 comments

@badrinathvm is it working with iOS i unable to view the loaded documents from iCloud please help is its working with iOS

yes it's working on iOS. What is the issue you are facing with iOS

I followed below steps

  1. Right Click on Libraries in Xcodeprpject , Then add the RNDocumentPicker.xcodeproj
  2. Got to Build Phases and link the library 'libRNDocumentPicker.a`
  3. Make sure to enable the titlements in Capapbalities section.

Any help on Android please ?

Fixed the issue , had forgot to add entry new ReactNativeDocumentPicker()
in MainApplication get Packages()

It works now..

@badrinathvm Thanks for replay. How can i view the selected file ?. I have used react-native-file-viewer but i unable to preview the file. Reference error https://github.com/vinzscam/react-native-file-viewer/issues/44 Please help me if you find any solution.

@bhoomesh950 You can read the file with RNFetchBlob library. In my case I'm using PDF, so I convert it to base64 string and pass to the PDFView library.

async convertFileToBase64(uri) {
        const file = Platform.OS === 'ios' ? uri.replace('file:', '') : uri
        await RNFetchBlob.fs.readFile(file,'base64')
            .then((baseCodedFile) => {
                this.props.navigation.navigate('UploadDocument', { documentPath: baseCodedFile, resourceType: 'base64' })
            })
}

That's a basic example

not working on RN 0.59.1

I think we need to open a Spectrum about it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cchumi picture Cchumi  路  3Comments

St1ma picture St1ma  路  5Comments

FrankFundel picture FrankFundel  路  5Comments

ashish-algorythma picture ashish-algorythma  路  7Comments

vsrinivas150283 picture vsrinivas150283  路  3Comments