Skip to content

Possible Unhandled Promise Rejection #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scrapecoder opened this issue Oct 7, 2021 · 5 comments
Closed

Possible Unhandled Promise Rejection #484

scrapecoder opened this issue Oct 7, 2021 · 5 comments

Comments

@scrapecoder
Copy link

scrapecoder commented Oct 7, 2021

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",
@vonovak
Copy link
Member

vonovak commented Oct 7, 2021

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

@scrapecoder
Copy link
Author

@vonovak I already tried but no luck

@vonovak
Copy link
Member

vonovak commented Oct 7, 2021

What platform is it on?

@Cavech84
Copy link

Cavech84 commented Oct 8, 2021

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,
          );

@vonovak
Copy link
Member

vonovak commented Oct 8, 2021

@vonovak vonovak closed this as completed Oct 8, 2021
@react-native-documents react-native-documents locked and limited conversation to collaborators Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants