Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Sending text messages with attached image

Does anyone have a working method for sending text messages that supports attaching local images from your React Native project? I'm currently using react-native-communications (https://github.com/anarchicknight/react-native-communications), which doesn't seem to support any attachments and only text.

When searching for libraries that support attachments, the only one I could find was react-native-message-composer (https://github.com/anarchicknight/react-native-message-composer). However, I followed the installation instructions, linked it correctly, and called the functions as they were presented in the docs, and nothing happens. It also only supports iOS.

So my question is does anybody know how to send text messages from a React Native app in a way that supports image attachments for both iOS and Android?

like image 310
Armin Avatar asked Nov 07 '22 21:11

Armin


1 Answers

One thing to keep in mind for future issues is to open the npm package file from node_modules and take a look at the code. I am currently looking at the code for react-native-communications and for the text method you can clearly see it only accepts a string. Also all react-native-communications is doing is being a user friendly wrapper for the Linking api. I'm going to attempt to tweak the npm package code to accept images. Will update with results.

UPDATE: I went into the Linking API code to check it out, also string only. Figured out the Linking API is also just a wrapper, for NativeModules.LinkingManager. http://facebook.github.io/react-native/docs/native-modules-ios.html

Tried implementing the LinkingManager myself. Same results as the wrapped versions. Road ends there. Doesn't appear that images are currently supported as the body for linking to sms. We should probably get on the React Native team about that.

like image 83
Nik Hammer-Ellis Avatar answered Nov 14 '22 22:11

Nik Hammer-Ellis