Skip to content

A React Native library for Sending an SMS with status listener

Notifications You must be signed in to change notification settings

rayansys/react-native-sms-sender

Repository files navigation

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);
	});
}

About

A React Native library for Sending an SMS with status listener

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published