{"_id":"@bopzor/react-native-sms-x","name":"@bopzor/react-native-sms-x","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@bopzor/react-native-sms-x","private":false,"version":"2.0.0","description":"React native android native api to send SMS in javascript programmatically, no linking to SMS Messenger View.","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","start":"node node_modules/react-native/local-cli/cli.js start","compile":"rm -rf lib && tsc -p .","prepare":"yarn compile"},"repository":{"type":"git","url":"git+https://github.com/bopzor/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 feat. bopzor"},"license":"Beerware","bugs":{"url":"https://github.com/bopzor/react-native-sms-x/issues"},"homepage":"https://github.com/bopzor/react-native-sms-x#readme","peerDependencies":{"react":"*","react-native":">=0.67"},"devDependencies":{"@types/react-native":"^0.72.2","react":"^16.4.2","react-native":"^0.67","typescript":"^5.1.6"},"gitHead":"b1350a9f38205a38bbfc10fe3c62e8df5a7f3cf7","_id":"@bopzor/react-native-sms-x@2.0.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-y00dw5uJJMiA13aHzDXeOnrqI/DXGgd7mKevCt99VDcZSiYGTDKWde0qsHW7YZr8Oq7Ww/j9vbTy3HbH28g2gg==","shasum":"bb1776bc7906977096122b8706a33572ba9ba773","tarball":"https://registry.npmjs.org/@bopzor/react-native-sms-x/-/react-native-sms-x-2.0.0.tgz","fileCount":20,"unpackedSize":87110,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKgWtm1VboQa2IkgTaKNTrZfNBaAuknbVthtCocC9QagIhAKoNHTUfSe6kj/jGj0xcJXGkcrg236NcZ73jStt72+NQ"}]},"_npmUser":{"name":"bopzor","email":"dev.violaine@gmail.com"},"directories":{},"maintainers":[{"name":"bopzor","email":"dev.violaine@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-sms-x_2.0.0_1690122084670_0.9379317842205692"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-23T14:21:24.533Z","2.0.0":"2023-07-23T14:21:24.894Z","modified":"2023-07-23T14:21:25.158Z"},"maintainers":[{"name":"bopzor","email":"dev.violaine@gmail.com"}],"description":"React native android native api to send SMS in javascript programmatically, no linking to SMS Messenger View.","homepage":"https://github.com/bopzor/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/bopzor/react-native-sms-x.git"},"author":{"name":"Ye Yint Ko Ko feat. bopzor"},"bugs":{"url":"https://github.com/bopzor/react-native-sms-x/issues"},"license":"Beerware","readme":"> I fork [original package](https://github.com/yeyintkoko/react-native-sms-x) to be able to published a more up-to-date version that works with Expo 48.0.18 and react-native 0.71.0. I also add TypeScript.\n\n## react-native-sms-x\n\n---\n\n**SendSMS**\n\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 the message id and a string indicating message was sent or failure or no service.\n\n_usage_\n\n```ts\nimport SendSMS from 'react-native-sms-x';\n// you can put any number as Id to identify which message being process\nSendSMS.send(\n  123,\n  '+959254687254',\n  'Hey.., this is me!\\nGood to see you. Have a nice day.',\n  (messageId: number, msg: string) => {\n    alert(msg);\n  }\n);\n```\n\nResponse msg string will be one of the following:\n\n- \"SMS sent\" - for successful message\n- \"Generic failure\" - for general failure\n- \"No service\" - for no mobile operator service\n- \"Radio off\" - for no mobile signal\n- \"Null PDU\" - for no PDU\n\n###### _Note:_\n\n###### Minimum android version is `4.1` and supported `RN >= v0.29`.\n\n---\n\n#### Installation\n\n```\nnpm install react-native-sms-x --save\n```\n\n---\n\n##### **Android Setup**\n\n1.In your `android/settings.gradle` file, make the following additions:\n\n```\ninclude ':react-native-sms-x'\nproject(':react-native-sms-x').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sms-x/android/app')\n```\n\n2.In your `android/app/build.gradle` file, add the ':react-native-sms-x' project as a compile-time dependency:\n\n```\n...\ndependencies {\n    ...\n    implementation project(':react-native-sms-x')\n}\n```\n\n3.In your `AndroidManifest.xml` file, add a user permission for sending SMS.\n\n```\n<uses-permission android:name=\"android.permission.SEND_SMS\" />\n```\n\n4.Update the `MainApplication.java` file as follow:\n\n> This step might not be needed. Skip if you see error: \"Native module SendSMS tried to override Send SMS...\"\n\n```java\nimport com.facebook.react.ReactApplication;\n...\nimport com.someone.sendsms.SendSMSPackage; // <--- add here!\n\n\npublic class MainApplication extends Application implements ReactApplication {\n\n  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {\n    @Override\n    protected boolean getUseDeveloperSupport() {\n      return BuildConfig.DEBUG;\n    }\n\n    @Override\n    protected List<ReactPackage> getPackages() {\n      return Arrays.<ReactPackage>asList(\n          new MainReactPackage(),\n          new SendSMSPackage()     // <--- add here!\n      );\n    }\n  };\n}\n```\n\n---\n\n**Example**\n\n```tsx\nimport React, { Component } from 'react';\nimport { AppRegistry, StyleSheet, Text, View, TouchableOpacity, ToastAndroid } from 'react-native';\nimport SendSMS from 'react-native-sms-x';\n\nexport default class RNSMS extends Component {\n  sendSMSFunction() {\n    SendSMS.send(\n      123,\n      '+95912345678',\n      'Hey.., this is me!\\nGood to see you. Have a nice day.',\n      (messageId: number, msg: string) => {\n        ToastAndroid.show(msg, ToastAndroid.SHORT);\n      }\n    );\n  }\n  render() {\n    return (\n      <View style={styles.container}>\n        <TouchableOpacity style={styles.button} onPress={this.sendSMSFunction.bind(this)}>\n          <Text>Send SMS</Text>\n        </TouchableOpacity>\n      </View>\n    );\n  }\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    backgroundColor: '#F5FCFF',\n  },\n  button: {\n    padding: 10,\n    borderWidth: 0.5,\n    borderColor: '#bbb',\n    margin: 10,\n    alignItems: 'center',\n    justifyContent: 'center',\n  },\n});\n\nAppRegistry.registerComponent('RNSMS', () => RNSMS);\n```\n\n## Support on Beerpay\n\nHey dude! Help me out for a couple of :beers:!\n\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)\n","readmeFilename":"README.md"}