1 Star 0 Fork 0

RN鸿蒙化项目团队/ty-react-native-blob-util

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ios.js 2.28 KB
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2016 wkh237@github. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be
// found in the LICENSE file.
import { Platform } from "react-native";
import ReactNativeBlobUtil from "./codegenSpecs/NativeBlobUtils";
/**
* Displays an options menu using UIDocumentInteractionController.presentOptionsMenu
* @param {string} path Path of the file to be open.
* @param {string} scheme URI scheme that needs to support, optional
* @return {Promise}
*/
function presentOptionsMenu(path: string, scheme: string) {
if (Platform.OS === "ios")
return ReactNativeBlobUtil.presentOptionsMenu("file://" + path, scheme);
else return Promise.reject("ReactNativeBlobUtil.openDocument only supports IOS.");
}
/**
* Displays a menu for opening the document using UIDocumentInteractionController.presentOpenInMenu
* @param {string} path Path of the file to be open.
* @param {string} scheme URI scheme that needs to support, optional
* @return {Promise}
*/
function presentOpenInMenu(path: string, scheme: string) {
if (Platform.OS === "ios")
return ReactNativeBlobUtil.presentOpenInMenu("file://" + path, scheme);
else return Promise.reject("ReactNativeBlobUtil.openDocument only supports IOS.");
}
/**
* Displays a full-screen preview of the target document using UIDocumentInteractionController.presentPreview
* @param {string} path Path of the file to be open.
* @param {string} scheme URI scheme that needs to support, optional
* @return {Promise}
*/
function presentPreview(path: string, scheme: string) {
if (Platform.OS === "ios" || Platform.OS === "harmony")
return ReactNativeBlobUtil.presentPreview("file://" + path, scheme);
else return Promise.reject("ReactNativeBlobUtil.previewDocument only supports IOS and harmony.");
}
/**
* Set excludeFromBackupKey to a URL to prevent the resource to be backuped to
* iCloud.
* @param {string} url URL of the resource, only file URL is supported
* @return {Promise}
*/
function excludeFromBackupKey(path: string) {
return ReactNativeBlobUtil.excludeFromBackupKey("file://" + path);
}
export default {
presentPreview,
openDocument: presentPreview, // legacy alias
presentOptionsMenu,
previewDocument: presentOptionsMenu, // legacy alias
presentOpenInMenu,
excludeFromBackupKey
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rn-mi/ty-react-native-blob-util.git
git@gitee.com:rn-mi/ty-react-native-blob-util.git
rn-mi
ty-react-native-blob-util
ty-react-native-blob-util
master

搜索帮助