iOS: "Mail" is available as option even though uninstalled
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
- Catch the error if
app === 'apple-mail' && something, return something useful - Check if there's a better way of determining whether Mail is actually installed
- Use
canOpenURLto 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 🙂
Sorry for the massively delayed response! :)
I think using canOpenURL is probably the most robust solution. A PR would be very welcome for this.
Is there any easy way to mitigate this or not show Mail as an option when a user doesn't have Mail.app installed?
Sorry for the massively delayed response! :)
I think using
canOpenURLis 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 :(