Browse Source

disabling launchCamera

master
analuizaff 4 years ago
parent
commit
82f088f72c
  1. 14
      src/app/components/ImageInput.js

14
src/app/components/ImageInput.js

@ -19,9 +19,9 @@ 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);
if(granted) { if(granted) {
launchCamera(); launchCamera();
@ -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,8 +112,8 @@ function ImageInput({ imageUri, onChangeImage }) {
</View> </View>
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</Modal> </Modal>
</View>*/}
</View> </View>
</View>
); );
} }

Loading…
Cancel
Save