|
@ -1,4 +1,4 @@ |
|
|
import React, { useState } from "react"; |
|
|
|
|
|
|
|
|
import React, { useState, useEffect } from "react"; |
|
|
import ErrorMessage from "./ErrorMessage"; |
|
|
import ErrorMessage from "./ErrorMessage"; |
|
|
import { useFormikContext } from "formik"; |
|
|
import { useFormikContext } from "formik"; |
|
|
import { |
|
|
import { |
|
@ -18,8 +18,7 @@ function PasswordFormField({ |
|
|
paddingRight = 16, |
|
|
paddingRight = 16, |
|
|
...otherProps |
|
|
...otherProps |
|
|
}) { |
|
|
}) { |
|
|
const { values, setFieldTouched, errors, touched } = useFormikContext(); |
|
|
|
|
|
const [fieldVal, setFieldVal] = useState(values[name]); |
|
|
|
|
|
|
|
|
const { values, setFieldTouched, setFieldValue, errors, touched } = useFormikContext(); |
|
|
const [hidePswd, setHidePswd] = useState(true); |
|
|
const [hidePswd, setHidePswd] = useState(true); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
@ -28,10 +27,8 @@ function PasswordFormField({ |
|
|
<TextInput |
|
|
<TextInput |
|
|
flex={1} |
|
|
flex={1} |
|
|
onBlur={() => setFieldTouched(name)} |
|
|
onBlur={() => setFieldTouched(name)} |
|
|
onChangeText={(val) => { |
|
|
|
|
|
setFieldVal(val); |
|
|
|
|
|
}} |
|
|
|
|
|
value={fieldVal.toString()} |
|
|
|
|
|
|
|
|
onChangeText={(v) => setFieldValue(name, v, true)} |
|
|
|
|
|
value={values[name]?.toString()} |
|
|
style={defaultStyles.text} |
|
|
style={defaultStyles.text} |
|
|
height={48} |
|
|
height={48} |
|
|
secureTextEntry={hidePswd} |
|
|
secureTextEntry={hidePswd} |
|
|