📌  相关文章
📜  react native share - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:30.533000             🧑  作者: Mango

代码示例1
import React from 'react';
import { Share, View, Button } from 'react-native';

const onShare = async () => {
    try {
        const result = await Share.share({
        message:
          'React Native | A framework for building native apps using React',
          });
          if (result.action === Share.sharedAction) {
        if (result.activityType) {
          // shared with activity type of result.activityType
        } else {
          // shared
        }
          } else if (result.action === Share.dismissedAction) {
        // dismissed
      }
    } catch (error) {
        alert(error.message);
    }
};