A blog for technology, SEO tips, website development and open source programming.

Open Phone Dialer on Android & ios with React Native

0 11,479

In react native we would use the Linking library to make this possible. So in this tutorial we would check out how to open Open Phone Dialer on Android & iOS.

Note: the tutorial work perfectly fine on Android emulator and real device but not on iOS simulator.

Steps

1) Import StyleSheetTextViewTouchableOpacityLinking and Platform component in your react native project’s App.js file.

2) Create a function named as dialCall() in your main class. This function is the backbone of our project. In this function we would first use the platform component to check the device is android or ios then if device is android then store the number value in phoneNumber variable. At last we would pass the phoneNumber variable in Lining component which would open this in our dial pad screen.

tel : Open the given number in android.

telprompt : Open the given number in iOS devices.

3) creating a button with Touchable opacity in render’s return block and call the dialCall function on button onPress event.

Below is the Complete source code for App.js file class.

Follow me on Instagram

That’s it for now. 

If you liked this article, then please subscribe to my YouTube Channel for video tutorials.

You can also find me on Twitter and Facebook.

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More