{"_id":"@averylicious/react-native-sms-x","name":"@averylicious/react-native-sms-x","dist-tags":{"latest":"1.0.7"},"versions":{"1.0.7":{"name":"@averylicious/react-native-sms-x","version":"1.0.7","description":"React native android native api to send SMS in javascript programmatically, no linking to SMS Messenger View.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","start":"node node_modules/react-native/local-cli/cli.js start"},"repository":{"type":"git","url":"git+https://github.com/yeyintkoko/react-native-sms-x.git"},"keywords":["send sms in react native","send sms in react-native","basic sms","send text sms","react native","react-native","send sms","sms","message","android","react","native","callback","mobile","npm","api","library","programmatically"],"author":{"name":"Ye Yint Ko Ko"},"license":"ISC","bugs":{"url":"https://github.com/yeyintkoko/react-native-sms-x/issues"},"homepage":"https://github.com/yeyintkoko/react-native-sms-x#readme","peerDependencies":{"react":"*","react-native":">=0.46"},"devDependencies":{"react":"^16.4.2","react-native":"^0.56.0"},"_id":"@averylicious/react-native-sms-x@1.0.7","gitHead":"e7c43d78058d4b7bbb15f253ced0f8388e1fc0f4","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-hB3ZcwhPZ1UJvpYZipXC4kz7YWlg5fbnq6JELbB9I7yhTFSq7HBGAlePGEOp4aHvkg4yG/b4HCm9+GnaXYz8Kg==","shasum":"aacb5faa67a82270e414d2f6e7bf226c08bc8856","tarball":"https://registry.npmjs.org/@averylicious/react-native-sms-x/-/react-native-sms-x-1.0.7.tgz","fileCount":17,"unpackedSize":88088,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMYabWYB96Z+lL92JBShsOAXIMI7CJG33nFLsV/CmbWgIhAIYJdOQCJEK2VWzps2xMCVGZX2057a84QlEk60JDCgz6"}]},"_npmUser":{"name":"averylicious","email":"landerbuan@gmail.com"},"directories":{},"maintainers":[{"name":"averylicious","email":"landerbuan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-sms-x_1.0.7_1710770982678_0.20029410792822633"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-18T14:09:42.560Z","1.0.7":"2024-03-18T14:09:42.880Z","modified":"2024-03-18T14:09:43.510Z"},"maintainers":[{"name":"averylicious","email":"landerbuan@gmail.com"}],"description":"React native android native api to send SMS in javascript programmatically, no linking to SMS Messenger View.","homepage":"https://github.com/yeyintkoko/react-native-sms-x#readme","keywords":["send sms in react native","send sms in react-native","basic sms","send text sms","react native","react-native","send sms","sms","message","android","react","native","callback","mobile","npm","api","library","programmatically"],"repository":{"type":"git","url":"git+https://github.com/yeyintkoko/react-native-sms-x.git"},"author":{"name":"Ye Yint Ko Ko"},"bugs":{"url":"https://github.com/yeyintkoko/react-native-sms-x/issues"},"license":"ISC","readme":"## react-native-sms-x\r\n***\r\n**SendSMS**\r\n\r\n> ##### A react-native api to send SMS messages. It works only for android. This component used android native api to send sms and response a callback to react-native. This react-native component doesn't link to the mobile default messenger view. It will programmatically send the message to a phone number which is provided as a parameter and will response a callback with a string indicating message was sent or failure or no service.\r\n\r\n*usage*\r\n```js\r\nimport SendSMS from 'react-native-sms-x';\r\n// you can put any number as Id to identify which message being process\r\nSendSMS.send(123, \"+959254687254\", \"Hey.., this is me!\\nGood to see you. Have a nice day.\", (msgId, msg) => {\r\n    console.log(`message ID: ${msgId}, message: ${msg}`);\r\n    // Output if successfull: message ID: 123, message: SMS sent\r\n});\r\n```\r\n\r\nResponse msg string will be one of the following:\r\n\r\n+ \"SMS sent\"        - for successful message\r\n+ \"Generic failure\" - for general failure\r\n+ \"No service\"      - for no mobile operator service\r\n+ \"Radio off\"       - for no mobile signal\r\n+ \"Null PDU\"        - for no PDU\r\n\r\n###### *Note:*\r\n\r\n###### Minimum android version is `4.1` and supported `RN >= v0.29`.\r\n---\r\n#### Installation\r\n```\r\nnpm install react-native-sms-x --save\r\n```\r\n---\r\n##### **Android Setup**\r\n\r\n1.In your `android/settings.gradle` file, make the following additions:\r\n\r\n```\r\ninclude ':react-native-sms-x'\r\nproject(':react-native-sms-x').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sms-x/android/app')\r\n```\r\n\r\n2.In your `android/app/build.gradle` file, add the ':react-native-sms-x' project as a compile-time dependency:\r\n\r\n```\r\n...\r\ndependencies {\r\n    ...\r\n    compile project(':react-native-sms-x')\r\n}\r\n```\r\n\r\n3.Update the `MainApplication.java` file as follow:\r\n\r\n```java\r\nimport com.facebook.react.ReactApplication;\r\n...\r\nimport com.someone.sendsms.SendSMSPackage; // <--- add here!\r\n\r\n\r\npublic class MainApplication extends Application implements ReactApplication {\r\n\r\n  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {\r\n    @Override\r\n    protected boolean getUseDeveloperSupport() {\r\n      return BuildConfig.DEBUG;\r\n    }\r\n\r\n    @Override\r\n    protected List<ReactPackage> getPackages() {\r\n      return Arrays.<ReactPackage>asList(\r\n          new MainReactPackage(),\r\n          new SendSMSPackage()     // <--- add here!\r\n      );\r\n    }\r\n  };\r\n\r\n  @Override\r\n  public ReactNativeHost getReactNativeHost() {\r\n      return mReactNativeHost;\r\n  }\r\n}\r\n```\r\n\r\n4.In your `AndroidManifest.xml` file, add a user permission for sending SMS.\r\n\r\n```\r\n<uses-permission android:name=\"android.permission.SEND_SMS\" />\r\n```\r\n---\r\n**Example**\r\n\r\n```js\r\nimport React, { Component } from 'react';\r\nimport {\r\n  AppRegistry,\r\n  StyleSheet,\r\n  Text,\r\n  View,\r\n  TouchableOpacity,\r\n  ToastAndroid\r\n} from 'react-native';\r\nimport SendSMS from 'react-native-sms-x';\r\n\r\nexport default class RNSMS extends Component {\r\n  sendSMSFunction() {\r\n    SendSMS.send(123, \"+95912345678\", \"Hey.., this is me!\\nGood to see you. Have a nice day.\",\r\n      (msgId, msg)=>{\r\n        ToastAndroid.show(msg, ToastAndroid.SHORT);\r\n      }\r\n    );\r\n  }\r\n  render() {\r\n    return (\r\n      <View style={styles.container}>        \r\n        <TouchableOpacity style={styles.button} onPress={this.sendSMSFunction.bind(this)}>\r\n          <Text>Send SMS</Text>\r\n        </TouchableOpacity>\r\n      </View>\r\n    );\r\n  }\r\n}\r\n\r\nconst styles = StyleSheet.create({\r\n  container: {\r\n    flex: 1,\r\n    justifyContent: 'center',\r\n    alignItems: 'center',\r\n    backgroundColor: '#F5FCFF',\r\n  },  \r\n  button: {\r\n    padding: 10,\r\n    borderWidth: .5,\r\n    borderColor: '#bbb',\r\n    margin: 10,\r\n    alignItems: 'center',\r\n    justifyContent: 'center'\r\n  }\r\n});\r\n\r\nAppRegistry.registerComponent('RNSMS', () => RNSMS);\r\n```\r\n\r\n## Support on Beerpay\r\nHey dude! Help me out for a couple of :beers:!\r\n\r\n[![Beerpay](https://beerpay.io/yeyintkoko/react-native-sms-x/badge.svg?style=beer-square)](https://beerpay.io/yeyintkoko/react-native-sms-x)  [![Beerpay](https://beerpay.io/yeyintkoko/react-native-sms-x/make-wish.svg?style=flat-square)](https://beerpay.io/yeyintkoko/react-native-sms-x?focus=wish)\r\n","readmeFilename":"README.md"}