import React, { useEffect, useState } from 'react';
import * as ImagePicker from 'expo-image-picker'
import Screen from './app/components/Screen';
export default function App() {
const requestPermission = async () => {
const { granted } = await ImagePicker.requestCameraRollPermissionsAsync();
if (!granted)
alert('Enable permission');
};
useEffect(() => {
requestPermission();
}, [])
return (
<Screen></Screen>
);
}
我尝试使用“expo-image-picker”来授予用户相机滚动权限。但是当我运行我的项目时,它显示“ImagePicker.requestCameraRollPermissionsAsync()被弃用,而使用ImagePicker.requestMediaLibraryPermissionsAsync()”。而且,我的Android设备上没有显示警告框。有人能解释一下这种情况吗?
1条答案
按热度按时间m528fe3b1#
从我的理解,
已过时,因此您应该使用