Launching SMS window


#1

Hello.

I am trying to use the Expo SMS functionality:
https://docs.expo.io/versions/latest/sdk/sms

I am using their example code as follows:

  handleSendSMS = () => {
    const isAvailable = SMS.isAvailableAsync();
    if (isAvailable) {
      // do your SMS stuff here
      this.sendSMS();
    } else {
      // misfortune... there's no SMS available on this device
    }

  };
  async sendSMS() {
    const { result } = await SMS.sendSMSAsync(['0123456789', '9876543210'], 'My sample HelloWorld message');
  }

I am testing on an actual iPhone, but I get the error Cannot read property ‘sendSMSAsync’ of undefined.

I have imported SMS as a component from expo:
import { MailComposer, SMS } from ‘expo’;

Note that MailComposer is for another feature where I launch the Mail app, and this is working fine.

Thanks in advance for any help getting this working.


closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.