|
@ -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(); |
|
|
} |
|
|
} |
|
|