This is an example app demonstrating the usage of @sourceship13/react-native-share-sms.
- Send SMS - Opens the Messages app directly with prefilled text
- Share SMS - Opens the share sheet to choose from available apps
Note: Make sure you have completed the React Native Environment Setup guide before proceeding.
- Node.js 18+
- Yarn or npm
- Xcode (for iOS)
- Android Studio (for Android)
From the root of the monorepo, install dependencies:
yarn installStart the Metro bundler from the root of the monorepo:
yarn example startIn a new terminal, run the app on your preferred platform:
# Install CocoaPods dependencies (first time only)
cd example/ios && bundle install && bundle exec pod install && cd ../..
# Run the app
yarn example iosNote: SMS functionality requires a physical device. The simulator cannot send SMS messages.
yarn example androidNote: SMS functionality works best on a physical device with the Messages app installed.
The example app demonstrates basic usage:
import { sendSMS, sendWithShareSMS } from '@sourceship13/react-native-share-sms';
// Direct SMS
const result = await sendSMS({
body: 'Hello from React Native!',
recipients: [], // Add phone numbers here
});
// Share Sheet
const shareResult = await sendWithShareSMS({
body: 'Shared via share sheet!',
});example/
├── src/
│ └── App.tsx # Main example component
├── ios/ # iOS native project
├── android/ # Android native project
└── package.json # Example app dependencies
This error occurs on the iOS Simulator. Test on a physical device.
Ensure you have a default SMS app installed (e.g., Google Messages).
Clean and rebuild:
# iOS
cd example/ios && rm -rf Pods Podfile.lock && bundle exec pod install && cd ../..
# Android
cd example/android && ./gradlew clean && cd ../..For more information, please visit CocoaPods Getting Started guide.
# Using npm
npm run ios
# OR using Yarn
yarn iosIf everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
Now that you have successfully run the app, let's make changes!
Open App.tsx in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by Fast Refresh.
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
- Android: Press the R key twice or select "Reload" from the Dev Menu, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS).
- iOS: Press R in iOS Simulator.
You've successfully run and modified your React Native App. 🥳
- If you want to add this new React Native code to an existing application, check out the Integration guide.
- If you're curious to learn more about React Native, check out the docs.
If you're having issues getting the above steps to work, see the Troubleshooting page.
To learn more about React Native, take a look at the following resources:
- React Native Website - learn more about React Native.
- Getting Started - an overview of React Native and how setup your environment.
- Learn the Basics - a guided tour of the React Native basics.
- Blog - read the latest official React Native Blog posts.
@facebook/react-native- the Open Source; GitHub repository for React Native.