analuizaff
4 years ago
3 changed files with 97 additions and 4 deletions
-
5src/App.js
-
89src/app/screens/PluviometerSharingDataScreen.js
-
5src/app/screens/SharingDataScreen.js
@ -0,0 +1,89 @@ |
|||||
|
import React, { useState } from "react"; |
||||
|
import { StyleSheet } from "react-native"; |
||||
|
import * as Yup from "yup"; |
||||
|
|
||||
|
import { |
||||
|
Form, |
||||
|
FormField, |
||||
|
FormPicker as Picker, |
||||
|
SubmitButton, |
||||
|
} from "../components/forms"; |
||||
|
import CategoryPickerItem from "../components/CategoryPickerItem"; |
||||
|
import Screen from "../components/Screen"; |
||||
|
import DatePicker from 'react-native-datepicker'; |
||||
|
import useLocation from "../hooks/useLocation"; |
||||
|
|
||||
|
const validationSchema = Yup.object().shape({ |
||||
|
title: Yup.string().required().min(1).label("Title"), |
||||
|
price: Yup.number().required().min(1).max(10000).label("Price"), |
||||
|
description: Yup.string().label("Description"), |
||||
|
category: Yup.object().required().nullable().label("Category"), |
||||
|
images: Yup.array().min(1, "Please select at least one image."), |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
function PluviometerSharingDataScreen() { |
||||
|
const location = useLocation(); |
||||
|
|
||||
|
const [date, setDate] = useState('09-10-2020'); |
||||
|
|
||||
|
return ( |
||||
|
<Screen style={styles.container}> |
||||
|
<Form |
||||
|
initialValues={{ |
||||
|
title: "", |
||||
|
price: "", |
||||
|
description: "", |
||||
|
category: null, |
||||
|
images: [], |
||||
|
}} |
||||
|
onSubmit={(values) => console.log(location)} |
||||
|
validationSchema={validationSchema} |
||||
|
> |
||||
|
<FormField |
||||
|
keyboardType="numeric" |
||||
|
maxLength={200} |
||||
|
name="price" |
||||
|
placeholder="não esstá atualizando" |
||||
|
width={220} |
||||
|
/> |
||||
|
<DatePicker |
||||
|
style={styles.datePickerStyle} |
||||
|
date={date} // Initial date from state
|
||||
|
mode="date" // The enum of date, datetime and time
|
||||
|
placeholder="select date" |
||||
|
format="DD-MM-YYYY" |
||||
|
minDate="01-01-2016" |
||||
|
maxDate="01-01-2019" |
||||
|
confirmBtnText="Confirm" |
||||
|
cancelBtnText="Cancel" |
||||
|
customStyles={{ |
||||
|
dateIcon: { |
||||
|
//display: 'none',
|
||||
|
position: 'absolute', |
||||
|
left: 0, |
||||
|
top: 4, |
||||
|
marginLeft: 0, |
||||
|
}, |
||||
|
dateInput: { |
||||
|
marginLeft: 36, |
||||
|
}, |
||||
|
}} |
||||
|
onDateChange={(date) => { |
||||
|
setDate(date); |
||||
|
}} |
||||
|
/> |
||||
|
|
||||
|
<SubmitButton title="Post" /> |
||||
|
</Form> |
||||
|
</Screen> |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
const styles = StyleSheet.create({ |
||||
|
container: { |
||||
|
padding: 10, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
export default PluviometerSharingDataScreen; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue