React-Native深度链接在iOS上不起作用

时间:2019-09-06 10:15:03

标签: javascript ios react-native

我希望customerServices组件中的两个按钮可以深度链接到电话的拨号盘和电话的电子邮件客户端。但是,Linking.openURL在iOS上不起作用,仅在Android上起作用。你会推荐什么?我有以下代码:

import React, { Component } from 'react';
import { Text, View, TouchableOpacity, StyleSheet, Image, Linking } from 'react-native';
import Container from '../../components/Container';
import { Images, Colors, FontFamily } from '../../components/Theme';
import InnerContainer from '../../components/InnerContainer';

export default class CustomerService extends Component {

    constructor(props) {
        super(props);
        this.state = {
        }
    }


    render() {
        return (
            <Container style={styles.container} type="mancsTRBL">
                <InnerContainer style={styles.innerContainer}>
                    <TouchableOpacity style={styles.sideCard} onPress={() => { Linking.openURL("tel://+36201234567") }}>
                        <View style={styles.row}>
                            <Image source={Images.call} style={styles.icon} />
                            <View>
                                <Text style={styles.serviceHeader}>Customer service</Text>
                                <Text style={styles.serviceText}>+36 20 123 4567</Text>
                            </View>
                        </View>
                    </TouchableOpacity>
                    <TouchableOpacity style={styles.sideCard} onPress={() => { Linking.openURL("mailto:email@email.com") }}>
                        <View style={styles.row}>
                            <Image source={Images.email} style={styles.icon} />
                            <View>
                                <Text style={styles.serviceHeader}>Email </Text>
                                <Text style={styles.serviceText}>email@email.cc</Text>
                            </View>
                        </View>
                    </TouchableOpacity>
                </InnerContainer>
            </Container>
        );
    }
}

0 个答案:

没有答案