Browse Source

Merge branch 'main' of github.com:IGSD-UoW/WPD-MobileApp into main

master
GabrielTrettel 4 years ago
parent
commit
fbc577ada3
  1. 12
      src/app/components/ImageInput.js
  2. 11899
      src/package-lock.json

12
src/app/components/ImageInput.js

@ -1,4 +1,4 @@
import React, { useEffect } from "react";
import React, { useEffect, useState } from "react";
import {
View,
StyleSheet,
@ -12,12 +12,11 @@ import {
import { MaterialCommunityIcons } from "@expo/vector-icons";
import * as ImagePicker from "expo-image-picker";
import colors from "../config/colors";
import { useState } from "react/cjs/react.development";
function ImageInput({ imageUri, onChangeImage }) {
useEffect(() => {
requestPermission();
requestPermissionCamera();
//requestPermissionCamera();
}, []);
const [modalVisible, setModalVisible] = useState(false);
@ -27,7 +26,10 @@ function ImageInput({ imageUri, onChangeImage }) {
};
const requestPermissionCamera = async () => {
const { granted } = await ImagePicker.requestCameraPermissionsAsync();
if (!granted) alert("Você precisa habilitar permissão para acessar a câmera.");
if(granted) {
launchCamera();
}
else if (!granted) alert("Você precisa habilitar permissão para acessar a câmera.");
};
const handlePress = () => {
@ -92,7 +94,7 @@ function ImageInput({ imageUri, onChangeImage }) {
<View style={styles.modalView}>
<View>
<Text style={styles.modalLabel}>Selecione uma imagem</Text>
<TouchableOpacity style={{ width: 300 }} onPress={launchCamera}>
<TouchableOpacity style={{ width: 300 }} onPress={requestPermissionCamera}>
<Text style={styles.modalText}>Câmera</Text>
</TouchableOpacity>
<TouchableOpacity style={{ width: 300 }} onPress={launchImageLibrary}>

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

Loading…
Cancel
Save