使用React Native预填充电子邮件地址

时间:2018-06-29 21:17:32

标签: node.js express react-native

是否有一种方法可以使用react-native提供的Share模块在IOS emial客户端中填充to:字段?

我正在为Andriod和IOS开发。 我查看了文档,但在SO上找不到任何帖子。

import React from 'react'
import { StyleSheet, Share, TouchableOpacity, View } from 'react-native';
import { connect } from 'react-redux'
import { Icon } from 'native-base'

class ContactEmail extends React.Component {
  static navigationOptions = {
    drawerLabel: () => null
  }
  render() {
    const activity = this.props.activity;
    console.log("what is this activity?", activity)
    let shareMessage = {
      to: "lams101@gmail.com",
      title: "",
      message: `I woudld like to pick up  ${activity.category.name} ${activity.product.name}. #RecycleBlue`,
      subject: `I am Interested in the ${activity.category.name}`, //  for email
      failOnCancel: false
    };

    return (
      <View style={styles.container}>
        <TouchableOpacity onPress={() => {
          Share.share(shareMessage)
            .then((res) => console.log(res))
            .catch((err) => {
              if (err) {
                return
              }
            })
        }}>
          <View style={styles.instructions}>
            <Icon name='share' />
          </View>
        </TouchableOpacity>
      </View>
    );
  }
}

0 个答案:

没有答案