我可以结合 2 个 expo 库、expo-document-picker 和 expo-drag-drop-content-view 来实现这种效果(expo 50)。
拖放组件将在onDrop事件中返回文件数据。assets作为base64编码的数据。
然后您只需将 base64 byteArray 数据转换为 URI:
const blob = new Blob([byteArray], { type: asset.type });
const uri = URL.createObjectURL(blob);
使用该 URI 的方式与使用 DocumentPicker 资产 URI 的方式完全相同。