diff --git a/src/app/components/ImageInput.js b/src/app/components/ImageInput.js
index b87ceef..4a2f2f1 100644
--- a/src/app/components/ImageInput.js
+++ b/src/app/components/ImageInput.js
@@ -19,8 +19,9 @@ function ImageInput({ imageUri, onChangeImage }) {
requestPermission();
//requestPermissionCamera();
}, []);
+ const [modalVisible, setModalVisible] = useState(false);
- /* const requestPermissionCamera = async () => {
+ const requestPermissionCamera = async () => {
const { granted } = await Permissions.askAsync(Permissions.CAMERA);
if(granted) {
launchCamera();
@@ -38,7 +39,7 @@ function ImageInput({ imageUri, onChangeImage }) {
} catch (error) {
console.log("Erro ao ler imagem", error);
}
- };*/
+ };
const requestPermission = async () => {
const { granted } = await ImagePicker.requestCameraRollPermissionsAsync();
@@ -47,7 +48,7 @@ function ImageInput({ imageUri, onChangeImage }) {
};
const handlePress = () => {
- if (!imageUri) launchImageLibrary();
+ if (!imageUri) setModalVisible(true);
else
Alert.alert("Deletar", "Deseja deletar esta imagem?", [
{ text: "Sim", onPress: () => onChangeImage(null) },
@@ -78,15 +79,43 @@ function ImageInput({ imageUri, onChangeImage }) {
size={40}
/>
)}
- {imageUri && (
-
- )}
+ {imageUri && }
+
+
+ {
+ setModalVisible(!setModalVisible);
+ }}>
+
+
+
+ Selecione uma imagem
+
+ Câmera
+
+
+ Galeria
+
+
+ { setModalVisible(false) }}>
+
+ Cancelar
+
+
+
+
+
+
+
);
}
+
const styles = StyleSheet.create({
container: {
alignItems: "center",
diff --git a/src/app/screens/PluviometerSharingDataScreen.js b/src/app/screens/PluviometerSharingDataScreen.js
index 7496468..22e84b9 100644
--- a/src/app/screens/PluviometerSharingDataScreen.js
+++ b/src/app/screens/PluviometerSharingDataScreen.js
@@ -21,7 +21,7 @@ import moment from 'moment';
import colors from "../config/colors";
const validationSchema = Yup.object().shape({
- pluviometer: Yup.number().required().min(1).max(10000).label("pluviometer"),
+ pluviometer: Yup.number().required("Campo obrigatório").min(0, "O valor deve ser maior ou igual a 0.").max(10000).label("pluviometer"),
data: Yup.string().min(1, "Por favor preencha a data"),
images: Yup.array().min(1, "Por favor, selecione uma imagem."),
});
@@ -102,7 +102,7 @@ function PluviometerSharingDataScreen(props) {
}}
validationSchema={validationSchema}
>
-
+
Quantidade de chuva:
@@ -110,8 +110,8 @@ function PluviometerSharingDataScreen(props) {
keyboardType="number-pad"
maxLength={200}
name="pluviometer"
- placeholder="Digite a quantidade de chuva"
- width={280}
+ placeholder="Digite a quantidade de chuva"
+ flex= {1}
/>
@@ -213,6 +213,8 @@ function PluviometerSharingDataScreen(props) {
const styles = StyleSheet.create({
container: {
padding: 10,
+ flex: 1
+
},
image: {
width: 85,