|
|
@ -50,23 +50,23 @@ function LocalDatePicker({ date, setDate, _moment }) { |
|
|
|
minimumDate={new Date(moment().subtract(110, "year"))} |
|
|
|
date={date} |
|
|
|
> |
|
|
|
<View style={[styles.dateInput, { flex: 1, marginRight: 12 }]}> |
|
|
|
<View style={[styles.dateInput, { flex: 1, paddingRight: 2 }]}> |
|
|
|
<Shadow |
|
|
|
offset={[0, 4]} |
|
|
|
distance={4} |
|
|
|
offset={[0, 3]} |
|
|
|
distance={3} |
|
|
|
radius={4} |
|
|
|
startColor="rgba(0, 0, 0, 0.25)" |
|
|
|
startColor="rgba(0, 0, 0, 0.15)" |
|
|
|
paintInside={true} |
|
|
|
viewStyle={{ width: "100%", height: 42 }} |
|
|
|
viewStyle={{ width: "100%", height: 48 }} |
|
|
|
> |
|
|
|
<View |
|
|
|
style={{ |
|
|
|
paddingLeft: 8, |
|
|
|
paddingLeft: 12, |
|
|
|
backgroundColor: colors.white, |
|
|
|
height: 42, |
|
|
|
height: 48, |
|
|
|
borderColor: colors.grayBG, |
|
|
|
borderWidth: 1, |
|
|
|
borderRadius: 5, |
|
|
|
borderRadius: 4, |
|
|
|
flexDirection: "row", |
|
|
|
alignItems: "center", |
|
|
|
}} |
|
|
@ -107,6 +107,26 @@ function GenderPicker({ value, setValue }) { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
function InstitutionPicker({ value, setValue }) { |
|
|
|
const [items, setItems] = useState([ |
|
|
|
{ value: "Escola", label: "Escola" }, |
|
|
|
{ value: "Defesa civil", label: "Defesa civil" }, |
|
|
|
{ value: "Não governamental", label: "Não governamental" }, |
|
|
|
{ value: "Outra", label: "Outra" }, |
|
|
|
{ value: "Nenhuma", label: "Nenhuma" }, |
|
|
|
]); |
|
|
|
return ( |
|
|
|
<SearchablePicker |
|
|
|
value={value} |
|
|
|
setValue={setValue} |
|
|
|
items={items} |
|
|
|
setItems={setItems} |
|
|
|
formPlaceholder={"Seleciona o tipo da instituição"} |
|
|
|
searchPlaceholder={"Busca..."} |
|
|
|
/> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
function StatePicker({ value, setValue }) { |
|
|
|
const [items, setItems] = useState(states); |
|
|
|
return ( |
|
|
@ -122,12 +142,10 @@ function StatePicker({ value, setValue }) { |
|
|
|
} |
|
|
|
|
|
|
|
function CityPicker({ value, setValue, state }) { |
|
|
|
console.log(state) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
state && setItems(statesToCities[state].cities) |
|
|
|
}, [state]) |
|
|
|
|
|
|
|
state && setItems(statesToCities[state].cities); |
|
|
|
}, [state]); |
|
|
|
|
|
|
|
const [items, setItems] = useState([]); |
|
|
|
return ( |
|
|
|
<SearchablePicker |
|
|
@ -136,7 +154,11 @@ function CityPicker({ value, setValue, state }) { |
|
|
|
items={items} |
|
|
|
setItems={setItems} |
|
|
|
formPlaceholder={"Selecione a sua cidade"} |
|
|
|
nothingToShow={state ? "Não encontramos nada com esse termo" : "Selecione o Estado primeiro"} |
|
|
|
nothingToShow={ |
|
|
|
state |
|
|
|
? "Não encontramos nada com esse termo" |
|
|
|
: "Selecione o Estado primeiro" |
|
|
|
} |
|
|
|
searchPlaceholder={"Busca..."} |
|
|
|
/> |
|
|
|
); |
|
|
@ -146,6 +168,8 @@ export default function RegisterScreen(props) { |
|
|
|
const [gender, setGender] = useState(""); |
|
|
|
const [state, setState] = useState(""); |
|
|
|
const [city, setCity] = useState(""); |
|
|
|
const [institution, setInstitution] = useState(""); |
|
|
|
const [secQuestion, setSecQuestion] = useState(""); |
|
|
|
|
|
|
|
const _moment = moment(); |
|
|
|
const [date, setDate] = useState(_moment); |
|
|
@ -169,6 +193,7 @@ export default function RegisterScreen(props) { |
|
|
|
confirmPassword: "", |
|
|
|
state: "", |
|
|
|
gender: "", |
|
|
|
institutionName: "", |
|
|
|
}} |
|
|
|
onSubmit={({ name, number, password, confirmPassword }) => { |
|
|
|
comparePassword(password, confirmPassword); |
|
|
@ -189,6 +214,7 @@ export default function RegisterScreen(props) { |
|
|
|
color={colors.primary} |
|
|
|
/> |
|
|
|
<FormField |
|
|
|
paddingRight={2} |
|
|
|
flex={1} |
|
|
|
maxLength={12} |
|
|
|
name="name" |
|
|
@ -201,7 +227,7 @@ export default function RegisterScreen(props) { |
|
|
|
<View style={styles.iconField}> |
|
|
|
<MaterialCommunityIcons |
|
|
|
name="phone" |
|
|
|
size={24} |
|
|
|
size={25} |
|
|
|
color={colors.primary} |
|
|
|
/> |
|
|
|
<FormField |
|
|
@ -210,6 +236,7 @@ export default function RegisterScreen(props) { |
|
|
|
name="number" |
|
|
|
numberOfLines={2} |
|
|
|
placeholder="Número de telefone celular" |
|
|
|
paddingRight={2} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
@ -227,6 +254,7 @@ export default function RegisterScreen(props) { |
|
|
|
secureTextEntry={true} |
|
|
|
numberOfLines={2} |
|
|
|
placeholder="Senha" |
|
|
|
paddingRight={2} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
@ -244,6 +272,7 @@ export default function RegisterScreen(props) { |
|
|
|
secureTextEntry={true} |
|
|
|
numberOfLines={2} |
|
|
|
placeholder="Repetir a senha" |
|
|
|
paddingRight={2} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
<ErrorMessage |
|
|
@ -251,11 +280,11 @@ export default function RegisterScreen(props) { |
|
|
|
visible={singUpFailed} |
|
|
|
/> |
|
|
|
|
|
|
|
<Text style={styles.labelStyle}>Data de nascimento</Text> |
|
|
|
<Text style={styles.labelStyle}>Data de nascimento:</Text> |
|
|
|
<View style={styles.iconField}> |
|
|
|
<MaterialCommunityIcons |
|
|
|
name="calendar-today" |
|
|
|
size={30} |
|
|
|
size={25} |
|
|
|
color={colors.primary} |
|
|
|
/> |
|
|
|
<LocalDatePicker |
|
|
@ -295,7 +324,39 @@ export default function RegisterScreen(props) { |
|
|
|
<CityPicker value={city} setValue={setCity} state={state} /> |
|
|
|
</View> |
|
|
|
|
|
|
|
<Text style={styles.labelStyle}>Tipo de instituição:</Text> |
|
|
|
<View style={[styles.iconField]}> |
|
|
|
<MaterialCommunityIcons |
|
|
|
name="bank" |
|
|
|
size={25} |
|
|
|
color={colors.primary} |
|
|
|
/> |
|
|
|
<InstitutionPicker |
|
|
|
value={institution} |
|
|
|
setValue={setInstitution} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
|
<Text style={styles.labelStyle}>Nome da instituição</Text> |
|
|
|
|
|
|
|
<View style={styles.iconField}> |
|
|
|
<MaterialCommunityIcons |
|
|
|
name="bank" |
|
|
|
size={25} |
|
|
|
color={colors.primary} |
|
|
|
/> |
|
|
|
<FormField |
|
|
|
flex={1} |
|
|
|
maxLength={12} |
|
|
|
name="institutionName" |
|
|
|
numberOfLines={2} |
|
|
|
placeholder="Digite o nome da instituição" |
|
|
|
paddingRight={2} |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
|
<SubmitButton |
|
|
|
flex={1} |
|
|
|
title="cadastrar" |
|
|
|
backgroundColor={colors.primary} |
|
|
|
marginTop={10} |
|
|
@ -341,8 +402,6 @@ const styles = StyleSheet.create({ |
|
|
|
marginBottom: 24, |
|
|
|
}, |
|
|
|
dateInput: { |
|
|
|
paddingLeft: 12, |
|
|
|
// flexDirection: "column",
|
|
|
|
// justifyContent: "center",
|
|
|
|
paddingLeft: 16, |
|
|
|
}, |
|
|
|
}); |