npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sourceship13/react-native-share-sms

v0.1.6

Published

This package allows a user to share a message thru using the share menu or thru directly sending a sms

Readme

@sourceship13/react-native-share-sms

A React Native library for sending SMS messages and sharing content via the native Messages app or share sheet. Supports both iOS and Android with attachments (images, videos, PDFs).

Features

  • 📱 Direct SMS - Open the Messages app directly with prefilled text and recipients
  • 🔗 Share Sheet - Use the native share sheet to let users choose their preferred app
  • 📎 Attachments - Send images, videos, PDFs, and other files as MMS
  • 🤖 Android & iOS - Full support for both platforms
  • Turbo Module - Built with the new React Native architecture for better performance

Installation

npm install @sourceship13/react-native-share-sms
# or
yarn add @sourceship13/react-native-share-sms

iOS Setup

Install CocoaPods dependencies:

cd ios && pod install && cd ..

Android Setup

No additional setup required. The library automatically configures the necessary permissions.

Usage

Basic SMS

Send a simple text message:

import { sendSMS } from '@sourceship13/react-native-share-sms';

const sendMessage = async () => {
  try {
    const result = await sendSMS({
      body: 'Hello from React Native!',
      recipients: ['+1234567890'], // Optional: prefill recipient numbers
    });

    if (result.success) {
      console.log('Message sent!');
    } else {
      console.log('Message cancelled or failed:', result.status);
    }
  } catch (error) {
    console.error('Error:', error);
  }
};

Using Share Sheet

Let users choose which app to share with:

import { sendWithShareSMS } from '@sourceship13/react-native-share-sms';

const sendMessageWThruShare = async () => {
  try {
    const result = await sendWithShareSMS({
      body: 'Check out this awesome content!',
    });

    console.log('Share result:', result.status);
  } catch (error) {
    console.error('Error:', error);
  }
};

With Attachments

Send images, videos, or other files:

import { sendSMS } from '@sourceship13/react-native-share-sms';

const sendWithAttachment = async () => {
  try {
    const result = await sendSMS({
      body: 'Check out this photo!',
      recipients: ['+1234567890'],
      attachments: [
        {
          uri: 'file:///path/to/image.jpg',
          mimeType: 'image/jpeg',
          filename: 'photo.jpg', // Optional
        },
      ],
    });

    console.log('Result:', result);
  } catch (error) {
    console.error('Error:', error);
  }
};

With Remote Images

The library supports remote URLs (http/https) - it will download and attach them automatically:

import { sendSMS } from '@sourceship13/react-native-share-sms';

const sendWithRemoteImage = async () => {
  const result = await sendSMS({
    body: 'Look at this!',
    attachments: [
      {
        uri: 'https://example.com/image.png',
        mimeType: 'image/png',
      },
    ],
  });
};

API Reference

sendSMS(options: SMSOptions): Promise<SMSResult>

Opens the native Messages app directly with prefilled content.

sendWithShareSMS(options: SMSOptions): Promise<SMSResult>

Opens the native share sheet, allowing users to choose Messages or other apps.

sendSmsCustomShare(options: SMSOptions): Promise<SMSResult>

Shows a custom iOS-style share sheet displaying only messaging apps. This provides a cleaner, more focused sharing experience when you specifically want users to share via messaging.

import { sendSmsCustomShare } from '@sourceship13/react-native-share-sms';

const shareViaMessages = async () => {
  const result = await sendSmsCustomShare({
    body: 'Shared via custom messaging sheet!',
    recipients: [],
  });
  
  if (result.success) {
    console.log('Shared successfully!');
  }
};

Types

interface SMSOptions {
  body: string;              // The message text
  recipients?: string[];     // Phone numbers to send to (optional)
  attachments?: Attachment[]; // Files to attach (optional)
}

interface Attachment {
  uri: string;       // File URI (file://, http://, https://, or content://)
  mimeType: string;  // MIME type (e.g., 'image/jpeg', 'video/mp4')
  filename?: string; // Optional filename
}

interface SMSResult {
  success: boolean;  // Whether the message was sent
  status: 'sent' | 'cancelled' | 'failed' | 'unknown';
  error?: string;    // Error message if failed
}

Supported MIME Types

| Type | Extensions | |------|------------| | Images | image/jpeg, image/png, image/gif, image/heic, image/webp | | Videos | video/mp4, video/quicktime | | Documents | application/pdf |

Example

See the example app for a complete working demo.

import React from 'react';
import { View, Button, Alert } from 'react-native';
import { sendSMS, sendWithShareSMS, sendSmsCustomShare } from '@sourceship13/react-native-share-sms';

export default function App() {
  const handleSendSMS = async () => {
    const result = await sendSMS({
      body: 'Hello!',
      recipients: [],
    });
    Alert.alert('Result', result.status);
  };

  const handleShare = async () => {
    const result = await sendWithShareSMS({
      body: 'Shared via share sheet!',
    });
    Alert.alert('Result', result.status);
  };

  const handleCustomShare = async () => {
    const result = await sendSmsCustomShare({
      body: 'Shared via custom messaging sheet!',
    });
    Alert.alert('Result', result.status);
  };

  return (
    <View style={{ flex: 1, justifyContent: 'center', padding: 20, gap: 10 }}>
      <Button title="Send SMS" onPress={handleSendSMS} />
      <Button title="Share" onPress={handleShare} />
      <Button title="Custom Share (Messages Only)" onPress={handleCustomShare} />
    </View>
  );
}

Platform Notes

iOS

  • Uses MFMessageComposeViewController for direct SMS
  • Uses UIActivityViewController for share sheet
  • Supports iMessage and SMS

Android

  • Uses the default SMS app via Intent.ACTION_SENDTO
  • Uses Intent.ACTION_SEND for share sheet
  • Automatically handles MMS for messages with attachments

Contributing

License

MIT


Made with create-react-native-library