|
@ -19,7 +19,7 @@ function ImageInput({ imageUri, onChangeImage }) { |
|
|
requestPermission(); |
|
|
requestPermission(); |
|
|
//requestPermissionCamera();
|
|
|
//requestPermissionCamera();
|
|
|
}, []); |
|
|
}, []); |
|
|
const [modalVisible, setModalVisible] = useState(false); |
|
|
|
|
|
|
|
|
/* const [modalVisible, setModalVisible] = useState(false); |
|
|
|
|
|
|
|
|
const requestPermissionCamera = async () => { |
|
|
const requestPermissionCamera = async () => { |
|
|
const { granted } = await Permissions.askAsync(Permissions.CAMERA); |
|
|
const { granted } = await Permissions.askAsync(Permissions.CAMERA); |
|
@ -39,7 +39,7 @@ function ImageInput({ imageUri, onChangeImage }) { |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.log("Erro ao ler imagem", error); |
|
|
console.log("Erro ao ler imagem", error); |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
};*/ |
|
|
|
|
|
|
|
|
const requestPermission = async () => { |
|
|
const requestPermission = async () => { |
|
|
const { granted } = await ImagePicker.requestCameraRollPermissionsAsync(); |
|
|
const { granted } = await ImagePicker.requestCameraRollPermissionsAsync(); |
|
@ -48,7 +48,9 @@ function ImageInput({ imageUri, onChangeImage }) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handlePress = () => { |
|
|
const handlePress = () => { |
|
|
if (!imageUri) setModalVisible(true); |
|
|
|
|
|
|
|
|
if (!imageUri) |
|
|
|
|
|
launchImageLibrary(); |
|
|
|
|
|
//setModalVisible(true);
|
|
|
else |
|
|
else |
|
|
Alert.alert("Deletar", "Deseja deletar esta imagem?", [ |
|
|
Alert.alert("Deletar", "Deseja deletar esta imagem?", [ |
|
|
{ text: "Sim", onPress: () => onChangeImage(null) }, |
|
|
{ text: "Sim", onPress: () => onChangeImage(null) }, |
|
@ -82,7 +84,7 @@ function ImageInput({ imageUri, onChangeImage }) { |
|
|
{imageUri && <Image source={{ uri: imageUri }} style={styles.image} />} |
|
|
{imageUri && <Image source={{ uri: imageUri }} style={styles.image} />} |
|
|
</View> |
|
|
</View> |
|
|
</TouchableWithoutFeedback> |
|
|
</TouchableWithoutFeedback> |
|
|
<View > |
|
|
|
|
|
|
|
|
{/*<View > |
|
|
<Modal style={styles.centeredView} |
|
|
<Modal style={styles.centeredView} |
|
|
animationType="slide" |
|
|
animationType="slide" |
|
|
transparent={true} |
|
|
transparent={true} |
|
@ -110,7 +112,7 @@ function ImageInput({ imageUri, onChangeImage }) { |
|
|
</View> |
|
|
</View> |
|
|
</TouchableWithoutFeedback> |
|
|
</TouchableWithoutFeedback> |
|
|
</Modal> |
|
|
</Modal> |
|
|
</View> |
|
|
|
|
|
|
|
|
</View>*/} |
|
|
</View> |
|
|
</View> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|