Skip to content

Possible Unhandled Promise Rejection  #484

Closed

Description

@scrapecoder

Bug report

Summary

Select_File = async () => {
	const { formData } = this.state;


	try {
		
		const res = await DocumentPicker.pick({
			type: [DocumentPicker.types.images, DocumentPicker.types.pdf]
		});

		this.setState({
			fileformData: [{ uri: res.uri, type: res.type, name: res.name }]
		});
	} catch (err) {
		
		if (DocumentPicker.isCancel(err)) {
			// User cancelled the picker, exit any dialogs or menus and move on
		} else {
			throw err;
		}
	}
};

Steps to reproduce

Whenever I'm calling Select_File fun, i'm getting warning Possible Unhandled Promise Rejection (id: 11): TypeError: null is not an object (evaluating 'RNDocumentPicker.pickDirectory') pickDirectory@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:202901:34
in emulator/real device.
I also tried with the different versions of react-native-document-picker but I'm getting this warning in all versions.

Environment info

npx react-native info output:

"react": "16.9.0",
"react-native": "0.61.5",
"react-native-document-picker": "5.2.0",

Activity

  1. vonovak commented on Oct 7, 2021

    @vonovak
    Member

    hello, can you please try with version 7 and report back? Thanks

  2. scrapecoder commented on Oct 7, 2021

    @scrapecoder
    Author

    @vonovak I already tried but no luck

  3. vonovak commented on Oct 7, 2021

    @vonovak
    Member

    What platform is it on?

  4. Cavech84 commented on Oct 8, 2021

    @Cavech84

    I have the same problem...
    "react": "17.0.2",
    "react-native": "0.64.2",
    "react-native-document-picker": "^7.1.0",

    the result of DocumentPicker.pick is undefined :

    const res = await DocumentPicker.pick({
                type: [
                  DocumentPicker.types.pdf,
                  DocumentPicker.types.doc,
                  DocumentPicker.types.docx,
                  DocumentPicker.types.ppt,
                  DocumentPicker.types.csv,
                  DocumentPicker.types.images,
                  DocumentPicker.types.plainText,
                  DocumentPicker.types.pptx,
                  DocumentPicker.types.xls,
                  DocumentPicker.types.xlsx,
                ],
              });
              console.log(
                res.uri,
                res.type, // mime type
                res.name,
                res.size,
              );
    
  5. vonovak commented on Oct 8, 2021

    @vonovak
    Member
  6. locked and limited conversation to collaborators on Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions