Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-native-sms-sender

rayansys37MIT1.0.0

A React Native library for Sending an SMS with status listener

react-native, react-component, react-native-component, react, mobile, ios, android, sms, callback, completed, react-native-send-sms, cool

readme

react-native-sms-sender

SendSMS

Use this RN component to send an SMS with a DeviceEventEmitter (SMS_STATUS_LISTENER). iOS and Android are both supported.

How to install

  1. npm install react-native-sms-sender --save

Using the module

Once everything is all setup, it's pretty simple:

SendSMS.send(myOptionsObject);

Object Properties

Key Type Platforms Required? Description
body String iOS/Android No The text that shows by default when the SMS is initiated
recipients Array (strings) iOS/Android No Provides the phone number recipients to show by default
## Example:
import SendSMS from 'react-native-sms-sender'

//some stuff

someFunction() {
    SendSMS.send({
        body: 'The default body of the SMS!',
        recipients: ['0123456789', '9876543210'],
    });

    //only for android |0:send,1:sent,2:delivered,3:errorSend,4:notDelivered|
    let statusListener = DeviceEventEmitter.addListener('SMS_STATUS_LISTENER', function(status) {
        console.log(status);
    });
}