Using Ionic React v7 with Capacitor v5, I am attempting to use @capacitor/share to share content via email. According to the docs and TypeScript typedocs on the share
method, the title
parameter should be treated as the subject if sharing via email.
I am instead experiencing the Share.share method is ignoring the title
parameter, instead using the text
parameter for both the email subject AND email content/
import { shareOutline } from 'ionicons/icons';
import { Share } from '@capacitor/share';
import { IonButton, IonIcon } from '@ionic/react';
export const SocialShare: React.FC<SocialShareProps> = ({}) => {
const onShare = () => {
return Share.share({
title: 'This is the title', // expected subject, actually ignored
text: 'Share text content here', // expected email content, actually email content AND email subject
url: 'https://open.spotify.com/track/4frLb7nWtsz2ymBE6k2GRP?si=c69e60933e904d47',
});
};
return (
<IonButton className='m-0 text-base' fill='clear' color='primary' mode='ios' onClick={onShare}>
Share
<IonIcon slot='icon-only' src={shareOutline} md={shareOutline} />
</IonButton>
);
};
results in