Home > Blockchain >  using deep link to open mail app in react native
using deep link to open mail app in react native

Time:04-29

I am trying to find out what the deeplink url is for the mail app in ios. I have an alert that is opening and then when a user presses 'ok', they will be redirected to the default mail app.

const openEmailApp = () => {
    if (Platform.OS === 'ios') {
      Linking.openURL('mailto:');
    }
};

I imagine the mail app deeplink is something like

mailapp:// 
Alert.alert('Verify Email address', 'Press Ok to open mail app', [
    {
      text: 'Cancel',
      onPress: () => navigation.navigate('Menu'),
      style: 'cancel',
    },
    {text: 'OK', onPress: {openEmailApp}},
  ]);

I am also getting an error for illegal cb function.

cb is not a function. (In 'cb(value)', 'cb' is an instance of Object)

CodePudding user response:

You were wrapping openEmailApp inside curly brackets. Write it like this

Alert.alert('Verify Email address', 'Press Ok to open mail app', [
    {
      text: 'Cancel',
      onPress: () => navigation.navigate('Menu'),
      style: 'cancel',
    },
    {text: 'OK', onPress: openEmailApp },
  ]);

  • Related