React Native Communications – Android iOS Example

Welcome friends, Today we would learn about a new react native NPM package named as React Native Communications. As we all know that in react native there are some functionalities which we cannot perform using native code. So to perform that type of functionality we have use the external NPM packages in our react native project. Today we are using NPM package to execute 4 types of different functionalities like Dialing call from react native android iOS app, Sending E-Mail from react native app, Sending SMS from react native app and Open given link in mobile default web browser. The React Native Communications library gives us easy to use inbuilt methods to perform this type of setup. So in this tutorial we would learn about React Native Communications Dial Call, Send E-Mail, Send SMS and Open link in web browser Android iOS Example.

Contents in this project React Native Communications – Android iOS Example :-

1. The first step is to download and install the React Native Communications package in your react native application. To download and install this package in your project open your project’s main Root directory in Command Prompt or Terminal and execute below command.

Screenshot:-

Screenshot after done installation:

2. After successfully done installation, next step is to start coding for the app. So open your project’s main App.js file and import View, StyleSheet, TouchableOpacity and Text component.

3. Now we have to import the Communications component from ‘react-native-communications’ package.

4. Creating our main export default functional component App.

5. Creating a function named as dialCall(). In this function we would call the Communications.phonecall() method to dial a call from react native application.

6. Creating a function named as sendEmail(). In this function we would call the Communications.email() method to send mail directly from our react native application. All the data we would pass in this method will be automatically filled into our G-Mail mail sending window.

7. Creating a function named as sendSMS(). In this method we would call the Communications.text() method to send SMS from react native app.

8. Creating another function named as openLink(). In this function we would call the Communications.web() method to open given website link from app into your mobile’s web browser.

9. Creating return() block. Now here we would make 1 Root View component -> 4 Touchable Opacity button . We would call each function on each button click event.

10. Creating Style.

11. Complete Source Code for App.js file :-

Screenshots:-

Leave a Reply

Your email address will not be published. Required fields are marked *