react-native-email-link icon indicating copy to clipboard operation
react-native-email-link copied to clipboard

iOS: "Mail" is available as option even though uninstalled

Open joenas opened this issue 5 years ago • 3 comments

It's possible to uninstall Mail on an iPhone, which I have for whatever reasons I can't remember. It still shows up in the list though and when you try to open it you get an error:

Error: Unable to open URL: mailto:[email protected]
    at createErrorFromErrorData (NativeModules.js:155)
    at NativeModules.js:104
    at MessageQueue.__invokeCallback (MessageQueue.js:414)
    at MessageQueue.js:127
    at MessageQueue.__guard (MessageQueue.js:314)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:126)
    at RNDebuggerWorker.js:2

~~That error can't be caught further up so it would have to be done here, if that's how you want to handle it.~~ I was making this mistake...

I'm not sure of the best approach here but I can see a few options

  1. Catch the error if app === 'apple-mail' && something, return something useful
  2. Check if there's a better way of determining whether Mail is actually installed
  3. Use canOpenURL to double check if it can be opened

I'll try out some of these approaches and can make a PR but would like to have some input from you first 🙂

joenas avatar Nov 27 '20 11:11 joenas

Sorry for the massively delayed response! :)

I think using canOpenURL is probably the most robust solution. A PR would be very welcome for this.

tschoffelen avatar Mar 25 '21 18:03 tschoffelen

Is there any easy way to mitigate this or not show Mail as an option when a user doesn't have Mail.app installed?

ghost avatar Sep 18 '21 18:09 ghost

Sorry for the massively delayed response! :)

I think using canOpenURL is probably the most robust solution. A PR would be very welcome for this.

@tschoffelen I think on iOS canOpenURL return always true for Mail even if the app is uninstalled. Like Apple Maps, if you uninstall Apple Maps, canOpenURL('maps://') return true :(

nicolasdevienne avatar Jul 29 '22 14:07 nicolasdevienne