2016-08-01 11:09:59.584 [warn][tid:com.facebook.react.JavaScript] Possible Unhandled Promise Rejection (id: 3):
getting this error on pressing close running the example
Filtering out the most rated answers from issues on Github |||||||||||_______|||| Also a sharing corner
2016-08-01 11:09:59.584 [warn][tid:com.facebook.react.JavaScript] Possible Unhandled Promise Rejection (id: 3):
getting this error on pressing close running the example
2016-08-01 11:09:59.584 [warn][tid:com.facebook.react.JavaScript] Possible Unhandled Promise Rejection (id: 3):
getting this error on pressing close running the example
@andyfenelon, @IsTheJack, Actually, this is solved by just adding in a catch
. If a user doesn’t share, it throws an error of Object {error: "User did not share"}
— which will be unhandled without a catch.
So to prevent the warning you can do:
Share.open({
// share config here
})
.catch(err => console.log(err));
I don’t really like this workaround. IMO the module shouldn’t reject the promise in this case because it’s not an “error scenario”. Can anybody reopen the issue ?
At least, the rejected value must allow distinction between this case and real errors (creating a UserCancelError
should do the job).
According to the JS coding conventions, a promise should reject a instance of Error (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject#Description), not an object containing a key named error
I’d remove the use of Exception
that is not standard in JavaScript: https://github.com/EstebanFuentealba/react-native-share/blob/master/index.js#L71 (or maybe it’s a Windows thing ?)
Are you guys open to a PR ?
Copyright © 2021 Fantas...hit
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
@andyfenelon, @IsTheJack, Actually, this is solved by just adding in a
catch
. If a user doesn’t share, it throws an error ofObject {error: "User did not share"}
— which will be unhandled without a catch.So to prevent the warning you can do:
I don’t really like this workaround. IMO the module shouldn’t reject the promise in this case because it’s not an “error scenario”. Can anybody reopen the issue ?
At least, the rejected value must allow distinction between this case and real errors (creating a
UserCancelError
should do the job).According to the JS coding conventions, a promise should reject a instance of Error (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject#Description), not an object containing a key named
error
I’d remove the use of
Exception
that is not standard in JavaScript: https://github.com/EstebanFuentealba/react-native-share/blob/master/index.js#L71 (or maybe it’s a Windows thing ?)Are you guys open to a PR ?