RN中拨打电话发送短信打开网址

导入组件

import Communications from 'react-native-communications' 

 <View style={Styles.container}>

        <Header center={'测试电话'} navigator={this.props.navigator} />

        <TouchableOpacity style={{ height: 40, marginTop: 40 }}

          onPress={() => {

            Communications.phonecall('10086', false);

          }}>

          <Text>调用系统打电话功能</Text>

        </TouchableOpacity>

        <TouchableOpacity style={{ height: 40, marginTop: 40 }}

          onPress={() => {

            Communications.text('10086', '要发送的内容');

            Communications.textWithoutEncoding('10086', '要发送的内容encoding');//这种方法需要将内容encoding

          }}>

          <Text>调用系统发短信功能</Text>

        </TouchableOpacity>

        <TouchableOpacity style={{ height: 40, marginTop: 40 }}

          onPress={() => {

            Communications.email(['emailAddress1', 'emailAddress2'], null, null, 'My Subject', 'My body text')

          }}>

          <Text>调用系统发邮件功能</Text>

        </TouchableOpacity>

        <TouchableOpacity style={{ height: 40, marginTop: 40 }}

          onPress={() => {

            Communications.web('https://github.com/facebook/react-native')

          }}>

          <Text>调用系统打开网页功能</Text>

        </TouchableOpacity>

      </View>

猜你喜欢

转载自blog.csdn.net/liulei21/article/details/82145400