Browse Source

importing expo permissions

master
analuizaff 4 years ago
parent
commit
acff016b2f
  1. 5
      src/app/components/ImageInput.js
  2. 2155
      src/package-lock.json

5
src/app/components/ImageInput.js

@ -11,6 +11,7 @@ import {
} from "react-native"; } from "react-native";
import { MaterialCommunityIcons } from "@expo/vector-icons"; import { MaterialCommunityIcons } from "@expo/vector-icons";
import * as ImagePicker from "expo-image-picker"; import * as ImagePicker from "expo-image-picker";
import * as Permissions from "expo-permissions";
import colors from "../config/colors"; import colors from "../config/colors";
function ImageInput({ imageUri, onChangeImage }) { function ImageInput({ imageUri, onChangeImage }) {
@ -21,11 +22,11 @@ function ImageInput({ imageUri, onChangeImage }) {
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const requestPermission = async () => { const requestPermission = async () => {
const { granted } = await ImagePicker.requestCameraRollPermissionsAsync();
const { granted } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
if (!granted) alert("Você precisa habilitar permissão para acessar a biblioteca."); if (!granted) alert("Você precisa habilitar permissão para acessar a biblioteca.");
}; };
const requestPermissionCamera = async () => { const requestPermissionCamera = async () => {
const { granted } = await ImagePicker.requestCameraPermissionsAsync();
const { granted } = await Permissions.askAsync(Permissions.CAMERA);
if(granted) { if(granted) {
launchCamera(); launchCamera();
} }

2155
src/package-lock.json
File diff suppressed because it is too large
View File

Loading…
Cancel
Save