小编Tha*_*nda的帖子

如何摆脱“允许Expo Go修改这张照片”?Android 中的警报

我正在开发 React Native expo 应用程序,该应用程序使用expo-image-picker拍摄照片,并使用expo-media-library将该图像保存到不同的位置。

一切似乎都工作正常,但每次用户捕获图像时都会弹出此弹出窗口。这种情况在 Android 上不断发生。它正在影响用户体验。

如果你们能帮我解决这个问题,那就太好了。谢谢

允许 Expo Go 修改这张照片吗?

版本

“反应本机”:“0.64.3”

“世博会”:“〜44.0.0”

"expo-image-picker": "~12.0.2"

"expo-media-library": "~14.0.0"

这是我用来存档提到的功能的代码。

import * as ImagePicker from "expo-image-picker";
import * as MediaLibrary from "expo-media-library";

const savePhoto = async (data, onSucess) => {
  const asset = await MediaLibrary.createAssetAsync(data?.uri);
  const album = await MediaLibrary.createAlbumAsync(
    "TEST_FOLDER",
    asset,
    false
  );
  const albumAssets = await MediaLibrary.getAssetsAsync({
    album: album,
    first: 1,
    sortBy: [[MediaLibrary.SortBy.creationTime, false]],
  });
  if (albumAssets?.assets[0]) {
    onSucess(albumAssets.assets[0], data);
  }
};

const …
Run Code Online (Sandbox Code Playgroud)

android media-library react-native expo imagepicker

5
推荐指数
1
解决办法
893
查看次数

标签 统计

android ×1

expo ×1

imagepicker ×1

media-library ×1

react-native ×1