SHARE
TWEET
Untitled
a guest
Jan 29th, 2018
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import React, { Component } from "react";
- import {
- View,
- Image,
- Dimensions,
- StatusBar,
- Text,
- Alert,
- ImageBackground,
- TouchableHighlight,
- TouchableWithoutFeedback,
- Platform,
- NativeModules,
- TouchableOpacity,
- Linking,
- } from "react-native";
- import { width, height } from "react-native-dimension";
- import RNImmediatePhoneCall from 'react-native-immediate-phone-call';
- // import call from "react-native-phone-call";
- // import ImageButton from "react-native-img-button";
- // import BackgroundImage from "../Components/Common/BackgroundImg";
- /* if we want to add the Image as a background */
- // import coverStyles from "../Styles/coverStyle";
- class Call extends Component {
- static navigationOptions = ({ navigation }) => {
- const { params, state, setParams } = navigation.state;
- return {
- tabBarLabel: "Позвъни",
- tintColor: '#ffffff',
- // onTabPress: () => {console.log('clickeddddddd') },
- // Note: By default the icon is only shown on iOS. Search the showIcon option below.
- // tabBarIcon: ({ tintColor }) => (
- // <TouchableWithoutFeedback onPress={this.params.onImageLoad()}>
- // <Image
- // source={require("../Images/Call/Call.png")}
- // style={[styles.icon, { tintColor }]}
- // />
- // </TouchableWithoutFeedback>
- // )
- tabBarIcon: (
- <TouchableWithoutFeedback onPress={() => params.onImageLoad()}>
- <Image
- source={require("../Images/Call/Call.png")}
- style={styles.icon}
- />
- </TouchableWithoutFeedback>
- )
- }
- };
- constructor(props) {
- super(props);
- this.state = { call: 0 };
- }
- // async onClick() {
- // const args = {
- // number: "tel:+359887733733", // String value with the number to call
- // prompt: false // Optional boolean property. Determines if the user should be prompt prior to the call
- // };
- // Linking.canOpenURL(args.number).then(supported => {
- // if (supported) {
- // Linking.openURL(args.number);
- // } else {
- // Alert.alert('Not supported');
- // }
- // }).catch((err) => {
- // Alert.alert('Can not call');
- // });
- // }
- componentWillMount() {
- // set handler method with setParams
- this.props.navigation.setParams({
- onImageLoad: () => this.onImageLoad()
- });
- }
- onImageLoad() {
- console.log('clicked');
- this.onClick();
- }
- async onClick() {
- RNImmediatePhoneCall.immediatePhoneCall('0887733733');
- }
- render() {
- return (
- <View>
- <StatusBar
- setHidden="no"
- style={{ resizeMode: "cover" }}
- backgroundColor="black"
- barStyle="light-content"
- />
- <View>
- <ImageBackground
- style={styles.container}
- source={require("../Images/Background.png")}
- imageStyle={{ resizeMode: "cover" }}
- >
- <View
- style={{
- flexDirection: "column",
- alignItems: "center",
- justifyContent: "center"
- }}
- >
- <View style={{ height: height(5), width: width(100) }} />
- <Image
- style={{
- resizeMode: "cover",
- width: width(75),
- height: height(19)
- }}
- source={require("../Images/Call/Logo.png")}
- />
- <TouchableOpacity onPress={this.onClick}>
- <Image
- style={{
- resizeMode: "stretch",
- width: width(100),
- height: height(80)
- }}
- source={require("../Images/Call/Tabela.png")}
- />
- </TouchableOpacity>
- </View>
- </ImageBackground>
- </View>
- </View>
- );
- }
- }
- const styles = {
- icon: {
- width: 25,
- height: 25,
- },
- container: {
- flex: 1,
- width: width(100),
- height: height(100),
- backgroundColor: "transparent",
- justifyContent: "center",
- alignItems: "center",
- position: "absolute"
- },
- resizeMode: {
- resizeMode: "cover"
- }
- };
- export { Call };
RAW Paste Data

