includable / react-native-email-link

📭 Open an email client from React Native (for 'magic link' type functionality).

Home Page:https://includable.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't catch error if no Email client on Android

pastoreli opened this issue · comments

I'm trying to handle with no email app exception, but it's not work on Android, because its never fall the .catch and .then always return null as result

Alert: Its work fine in IOS

openInbox({
 title: 'Title',
 message: 'Message',
}).catch((err: EmailException) => {
 if (err.message === 'No email apps available') {
  alert('No email');
  } else {
   alert('Default error');
  }
 });

I think this information is indeed currently not passed back from the native bit of the Android integration to the javascript side. Definitely something we could add I think.

I think this information is indeed currently not passed back from the native bit of the Android integration to the javascript side. Definitely something we could add I think.

This would be much appreciated. The lack of throwing an error when no email client is found on Android is potentially a blocker for me right now in using this library.

Anyone able to do a PR for this?

Anyone able to do a PR for this?

Yes, I can. I have already created the fix in a forked repo - will create the PR later today.