daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from "react";
  2. import {
  3.   View,
  4.   Image,
  5.   Dimensions,
  6.   StatusBar,
  7.   Text,
  8.   Alert,
  9.   ImageBackground,
  10.   TouchableHighlight,
  11.   TouchableWithoutFeedback,
  12.   Platform,
  13.   NativeModules,
  14.   TouchableOpacity,
  15.   Linking,
  16. } from "react-native";
  17. import { width, height } from "react-native-dimension";
  18. import RNImmediatePhoneCall from 'react-native-immediate-phone-call';
  19.  
  20. // import call from "react-native-phone-call";
  21. // import ImageButton from "react-native-img-button";
  22. // import BackgroundImage from "../Components/Common/BackgroundImg";
  23. /* if we want to add the Image as a background */
  24. // import coverStyles from "../Styles/coverStyle";
  25.  
  26. class Call extends Component {
  27.   static navigationOptions = ({ navigation }) =>  {
  28.     const { params, state, setParams } = navigation.state;
  29.  
  30.     return {
  31.       tabBarLabel: "Позвъни",
  32.       tintColor: '#ffffff',
  33.       // onTabPress: () => {console.log('clickeddddddd') },
  34.       // Note: By default the icon is only shown on iOS. Search the showIcon option below.
  35.       // tabBarIcon: ({ tintColor }) => (
  36.      
  37.       //   <TouchableWithoutFeedback onPress={this.params.onImageLoad()}>
  38.       //   <Image
  39.       //   source={require("../Images/Call/Call.png")}
  40.       //   style={[styles.icon, { tintColor }]}
  41.       //     />
  42.       //   </TouchableWithoutFeedback>  
  43.       // )
  44.       tabBarIcon: (
  45.         <TouchableWithoutFeedback onPress={() => params.onImageLoad()}>
  46.         <Image
  47.           source={require("../Images/Call/Call.png")}
  48.           style={styles.icon}
  49.           />
  50.         </TouchableWithoutFeedback>    
  51.       )
  52.     }
  53.   };
  54.   constructor(props) {
  55.     super(props);
  56.     this.state = { call: 0 };
  57.   }
  58.   // async onClick() {
  59.   //   const args = {
  60.   //     number: "tel:+359887733733", // String value with the number to call
  61.   //     prompt: false // Optional boolean property. Determines if the user should be prompt prior to the call
  62.   //   };
  63.   //   Linking.canOpenURL(args.number).then(supported => {
  64.   //     if (supported) {
  65.   //         Linking.openURL(args.number);
  66.   //     } else {
  67.   //         Alert.alert('Not supported');
  68.   //     }
  69.   // }).catch((err) => {
  70.   //     Alert.alert('Can not call');
  71.   // });
  72.   // }
  73.   componentWillMount() {
  74.     // set handler method with setParams
  75.     this.props.navigation.setParams({
  76.         onImageLoad: () => this.onImageLoad()
  77.     });
  78.   }
  79.   onImageLoad() {
  80.     console.log('clicked');
  81.     this.onClick();
  82. }  
  83.   async onClick() {
  84.     RNImmediatePhoneCall.immediatePhoneCall('0887733733');
  85.   }
  86.   render() {
  87.     return (
  88.       <View>
  89.         <StatusBar
  90.           setHidden="no"
  91.           style={{ resizeMode: "cover" }}
  92.           backgroundColor="black"
  93.           barStyle="light-content"
  94.         />
  95.         <View>
  96.           <ImageBackground
  97.             style={styles.container}
  98.             source={require("../Images/Background.png")}
  99.             imageStyle={{ resizeMode: "cover" }}
  100.           >
  101.             <View
  102.               style={{
  103.                 flexDirection: "column",
  104.                 alignItems: "center",
  105.                 justifyContent: "center"
  106.               }}
  107.             >
  108.               <View style={{ height: height(5), width: width(100) }} />
  109.               <Image
  110.                 style={{
  111.                   resizeMode: "cover",
  112.                   width: width(75),
  113.                   height: height(19)
  114.                 }}
  115.                 source={require("../Images/Call/Logo.png")}
  116.               />
  117.               <TouchableOpacity onPress={this.onClick}>
  118.                 <Image
  119.                   style={{
  120.                     resizeMode: "stretch",
  121.                     width: width(100),
  122.                     height: height(80)
  123.                   }}
  124.                   source={require("../Images/Call/Tabela.png")}
  125.                 />
  126.               </TouchableOpacity>
  127.             </View>
  128.           </ImageBackground>
  129.         </View>
  130.       </View>
  131.     );
  132.   }
  133. }
  134. const styles = {
  135.   icon: {
  136.     width: 25,
  137.     height: 25,
  138.   },
  139.   container: {
  140.     flex: 1,
  141.     width: width(100),
  142.     height: height(100),
  143.     backgroundColor: "transparent",
  144.     justifyContent: "center",
  145.     alignItems: "center",
  146.     position: "absolute"
  147.   },
  148.   resizeMode: {
  149.     resizeMode: "cover"
  150.   }
  151. };
  152. export { Call };
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top