Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

How To Open Phone Dialer and Make Call From React Native App

import React from 'react';
import {
  View,
  Text,
  Linking,
  TouchableOpacity,
  Platform,
  StyleSheet,
} from 'react-native';

const Home = () => {
  const openDialScreen = () => {
    let number = '';
    if (Platform.OS === 'ios') {
      number = 'telprompt:${091123456789}';
    } else {
      number = 'tel:${091123456789}';
    }
    Linking.openURL(number);
  };

  return (
    <View style={styles.container}>
      <TouchableOpacity onPress={() => openDialScreen()}>
        <Text style={styles.TextStyle}>Click to Open Dial Screen </Text>
      </TouchableOpacity>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'white',
  },
});

export default Home;
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to randomize an array 
Javascript :: flutter print json 
Javascript :: disable javascript chrome 
Javascript :: node js kill process 
Javascript :: how to round numbers in javscript 
Javascript :: how to add youtube videos to react app 
Javascript :: javascript highlight words 
Javascript :: check if isset variable js 
Javascript :: iife javascript 
Javascript :: preview upload image js 
Javascript :: accessing object properties with bracket notation 
Javascript :: jest to include text 
Javascript :: how to get selected value of a dropdown menu in reactjs 
Javascript :: javascript create element input type text 
Javascript :: settimeout in loop javascript 
Javascript :: get element of an array inside another array 
Javascript :: react uselazyquery and usequery 
Javascript :: axios delete request payload 
Javascript :: jquery detect textarea change 
Javascript :: how to take screenshot of desktop using electron js 
Javascript :: javascript check for null variables 
Javascript :: add property to all documents mongo 
Javascript :: disabling submit button until all fields have values 
Javascript :: npm run js file from command line 
Javascript :: lowercase to uppercase in javascript 
Javascript :: connect mysql to node js 
Javascript :: routes in node js 
Javascript :: Moment.js: Date between dates 
Javascript :: javascript separate string by character 
Javascript :: first letter uppercase js 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =