forked from cemaden-educacao/WPD-MobileApp
GabrielTrettel
3 years ago
8 changed files with 230 additions and 224 deletions
-
14src/app/components/DatePicker.js
-
4src/app/components/PickEventDateLocation.js
-
231src/app/components/SchoolPicker.js
-
112src/app/components/forms/FormDatePicker.js
-
13src/app/components/forms/FormLocationPicker.js
-
5src/app/components/forms/SubmitButton.js
-
2src/app/config/colors.js
-
71src/app/screens/PluviometerRegisterScreen.js
@ -1,140 +1,131 @@ |
|||
import React, { useState, Fragment } from "react"; |
|||
import React, { useState, Fragment } from "react"; |
|||
import { StyleSheet, View } from "react-native"; |
|||
|
|||
import { FontAwesome5 } from '@expo/vector-icons'; |
|||
import { FontAwesome5 } from "@expo/vector-icons"; |
|||
import colors from "../config/colors"; |
|||
import SearchableDropdown from 'react-native-searchable-dropdown'; |
|||
import SearchableDropdown from "react-native-searchable-dropdown"; |
|||
|
|||
const items = [ |
|||
//substituir posteriormente pelas escolas
|
|||
{ |
|||
id: 1, |
|||
name: 'JavaScript', |
|||
}, |
|||
{ |
|||
id: 2, |
|||
name: 'Java', |
|||
}, |
|||
{ |
|||
id: 3, |
|||
name: 'Ruby', |
|||
}, |
|||
{ |
|||
id: 4, |
|||
name: 'React Native', |
|||
}, |
|||
{ |
|||
id: 5, |
|||
name: 'PHP', |
|||
}, |
|||
{ |
|||
id: 6, |
|||
name: 'Python', |
|||
}, |
|||
//substituir posteriormente pelas escolas
|
|||
{ |
|||
id: 1, |
|||
name: "JavaScript", |
|||
}, |
|||
{ |
|||
id: 2, |
|||
name: "Java", |
|||
}, |
|||
{ |
|||
id: 3, |
|||
name: "Ruby", |
|||
}, |
|||
{ |
|||
id: 4, |
|||
name: "React Native", |
|||
}, |
|||
{ |
|||
id: 5, |
|||
name: "PHP", |
|||
}, |
|||
{ |
|||
id: 6, |
|||
name: "Python", |
|||
}, |
|||
{ |
|||
id: 7, |
|||
name: "Python", |
|||
}, |
|||
{ |
|||
id: 8, |
|||
name: "Python", |
|||
}, |
|||
|
|||
{ |
|||
id: 9, |
|||
name: "Python", |
|||
}, |
|||
]; |
|||
|
|||
function SchoolPicker(props) { |
|||
const [selectedItems, setSelectedItems] = useState(null); |
|||
|
|||
const selected = ( i ) => { |
|||
setSelectedItems(i); |
|||
props.itemSelected(i); |
|||
//console.log(i.name);
|
|||
}; |
|||
|
|||
|
|||
return ( |
|||
<View style={{ flex: 1, width: "100%", marginTop: 10 }}> |
|||
<View style={styles.location}> |
|||
<View style={styles.mapIcon}> |
|||
<FontAwesome5 |
|||
name="university" |
|||
size={28} |
|||
color="white" |
|||
alignItems="center" |
|||
alignContent="center" |
|||
/> |
|||
</View> |
|||
<View style={styles.adressText}> |
|||
<Fragment> |
|||
<SearchableDropdown |
|||
multi={false} |
|||
selectedItems={selectedItems} |
|||
onItemSelect={(item) => { |
|||
selected(item) |
|||
}} |
|||
containerStyle={{ padding: 5 }} |
|||
itemStyle={{ |
|||
padding: 10, |
|||
marginTop: 2, |
|||
backgroundColor: '#ddd', |
|||
borderColor: '#bbb', |
|||
borderWidth: 1, |
|||
borderRadius: 6, |
|||
width: "100%", |
|||
}} itemTextStyle={{ color: '#222' }} |
|||
itemsContainerStyle={{ maxHeight: "100%" }} |
|||
items={items} |
|||
chip={true} |
|||
resetValue={false} |
|||
textInputProps={ |
|||
{ |
|||
placeholder: "Escola onde você estuda...", |
|||
underlineColorAndroid: "transparent", |
|||
style: { |
|||
padding: 12, |
|||
borderWidth: 1, |
|||
borderColor: '#ccc', |
|||
borderRadius: 5, |
|||
alignItems:"flex-start", |
|||
alignContent:"flex-start", |
|||
}, |
|||
onTextChange: text => console.log(text) |
|||
} |
|||
const [selectedItems, setSelectedItems] = useState(null); |
|||
|
|||
} |
|||
listProps={ |
|||
{ |
|||
nestedScrollEnabled: true, |
|||
const selected = (i) => { |
|||
setSelectedItems(i); |
|||
props.itemSelected(i); |
|||
//console.log(i.name);
|
|||
}; |
|||
|
|||
} |
|||
} |
|||
/> |
|||
</Fragment> |
|||
|
|||
</View> |
|||
</View> |
|||
return ( |
|||
<View style={{ width: "100%" }}> |
|||
<View style={styles.location}> |
|||
<View style={styles.mapIcon}> |
|||
<FontAwesome5 |
|||
name="university" |
|||
size={30} |
|||
color={colors.primary} |
|||
/> |
|||
</View> |
|||
<View style={styles.adressText}> |
|||
<Fragment> |
|||
<SearchableDropdown |
|||
multi={false} |
|||
selectedItems={selectedItems} |
|||
onItemSelect={(item) => { |
|||
selected(item); |
|||
}} |
|||
itemStyle={{ |
|||
padding: 10, |
|||
marginTop: 2, |
|||
backgroundColor: "#fff", |
|||
borderColor: "#bbb", |
|||
borderWidth: 1, |
|||
borderRadius: 6, |
|||
width: "100%", |
|||
}} |
|||
itemTextStyle={{ color: "#222" }} |
|||
itemsContainerStyle={{ maxHeight: "100%" }} |
|||
items={items} |
|||
chip={true} |
|||
resetValue={false} |
|||
textInputProps={{ |
|||
placeholder: "Escola onde você estuda...", |
|||
underlineColorAndroid: "transparent", |
|||
style: { |
|||
padding: 12, |
|||
borderWidth: 1, |
|||
borderColor: "#ccc", |
|||
borderRadius: 5, |
|||
alignItems: "flex-start", |
|||
backgroundColor: colors.white, |
|||
alignContent: "flex-start", |
|||
}, |
|||
onTextChange: (text) => console.log(text), |
|||
}} |
|||
/> |
|||
</Fragment> |
|||
</View> |
|||
); |
|||
</View> |
|||
</View> |
|||
); |
|||
} |
|||
|
|||
SchoolPicker.defaultProps = { |
|||
itemSelected: () =>{ }, |
|||
itemSelected: () => {}, |
|||
}; |
|||
|
|||
const styles = StyleSheet.create({ |
|||
location: { |
|||
//flex: 1,
|
|||
width: "100%", |
|||
flexDirection: "row", |
|||
alignItems: "flex-start", |
|||
justifyContent: "center", |
|||
zIndex: 10, |
|||
position: "absolute", |
|||
backgroundColor: colors.white, |
|||
}, |
|||
adressText: { |
|||
flex: 0.90, |
|||
}, |
|||
mapIcon: { |
|||
backgroundColor: colors.primary, |
|||
padding: 8, |
|||
width: 20, |
|||
alignItems: "center", |
|||
borderRadius: 5, |
|||
flex: 0.10, |
|||
marginTop: 8, |
|||
}, |
|||
location: { |
|||
flexDirection: "row", |
|||
}, |
|||
adressText: { |
|||
flex: 1 |
|||
}, |
|||
mapIcon: { |
|||
paddingTop: 10, |
|||
alignSelf: "flex-start", |
|||
paddingRight: 12, |
|||
|
|||
}, |
|||
}); |
|||
|
|||
export default SchoolPicker; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue