javascript - WhatsApp 使用 Android 中的 expo 共享库共享(React-native)
问题描述
我想将图像文件直接共享到我的whatsApp 或将其添加到我的whatsApp 状态,即当我单击按钮共享任何图像时,我不想看到任何其他共享选项。目前我正在使用以下代码分享
import * as Sharing from 'expo-sharing';
import * as FileSystem from 'expo-file-system';
const customShare = async (image) => {
const base64result = image.split(',')[1];
try {
let filename = 'share.png'; // or some other way to generate filename
let filepath = `${FileSystem.documentDirectory}/${filename}`;
await FileSystem.writeAsStringAsync(filepath, base64result, { encoding: 'base64' });
await Sharing.shareAsync(filepath, { mimeType: 'image/gif' })
} catch (e) {
alert(e.message);
}
};
但是这里显示所有共享选项可供选择,有没有办法跳过这一步直接打开我的WhatsApp
解决方案
推荐阅读
- swagger - 如何在 springfox 3.0.0 中使用默认值配置全局标头
- python - 如何使用文本文件在 Python 中返回字典
- python - 如何激活 while true 语句
- javascript - 如何在 React 应用程序中同步数据?呈现的数据与函数调用中访问的数据不匹配
- javascript - 注销后如何删除鼠标向上事件处理程序?
- ffmpeg - FFMPEG 复用为私有数据流,读取时可能无法识别
- reactjs - 如何从外部引用组件内部的函数?
- react-native - 更新 React Native Stack Navigator 标头中的徽章
- c# - (统一)有没有办法设置粒子系统中每个粒子的位置?
- google-cloud-platform - 如何将容器部署到多个 GCP 项目并使用 Cloud Run 托管?