How to use the expo-sms.sendSMSAsync function in expo-sms

To help you get started, we’ve selected a few expo-sms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / apps / native-component-list / src / screens / SMSScreen.tsx View on Github external
_sendSMS = async () => {
    const isAvailable = await SMS.isAvailableAsync();
    if (!isAvailable) {
      this.setState({
        error: 'SMS functionality is not available on this device!',
      });
      setTimeout(() => this.setState({ error: undefined }), 10000);
      return;
    }
    try {
      if (this.state.message) {
        const { result } = await SMS.sendSMSAsync(
          this.state.phoneNumbers,
          this.state.message
        );
        this.setState({ phoneNumbers: [], message: undefined, result });
        setTimeout(() => this.setState({ result: undefined }), 5000);
      }
    } catch (e) {
      this.setState({ error: e.message });
      setTimeout(() => this.setState({ error: undefined }), 10000);
    }
  }
github keybase / client / shared / util / sms.native.tsx View on Github external
return SMS.isAvailableAsync().then(isAvailable => {
    if (!isAvailable) {
      throw new Error('SMS not available')
    }
    return SMS.sendSMSAsync(phonenos, body || '')
  })
}

expo-sms

Provides access to the system's UI/app for sending SMS messages.

MIT
Latest version published 3 months ago

Package Health Score

89 / 100
Full package analysis