Browse Source

Adding scroll view to change password screens

master
GabrielTrettel 3 years ago
parent
commit
de94d72999
  1. 3
      src/app/screens/PasswordRecoveryChangePswdScreen.js
  2. 9
      src/app/screens/PasswordRecoveryScreen.js

3
src/app/screens/PasswordRecoveryChangePswdScreen.js

@ -8,6 +8,7 @@ import { dimensions } from "../config/dimensions";
import PasswordFormField from "../components/forms/PasswordFormField"; import PasswordFormField from "../components/forms/PasswordFormField";
import ConfirmationModal from "../components/ConfirmationModal"; import ConfirmationModal from "../components/ConfirmationModal";
import { updatePassword } from "../api/auth"; import { updatePassword } from "../api/auth";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
password: Yup.string() password: Yup.string()
@ -81,6 +82,7 @@ export default function PasswordRecoveryChangePswd({ navigation, route }) {
}} }}
/> />
<KeyboardAwareScrollView>
<Form <Form
validationSchema={validationSchema} validationSchema={validationSchema}
initialValues={{ initialValues={{
@ -129,6 +131,7 @@ export default function PasswordRecoveryChangePswd({ navigation, route }) {
<SubmitButton title="confirmar" backgroundColor={colors.primary} /> <SubmitButton title="confirmar" backgroundColor={colors.primary} />
</Form> </Form>
</KeyboardAwareScrollView>
</View> </View>
); );
} }

9
src/app/screens/PasswordRecoveryScreen.js

@ -9,6 +9,7 @@ import PhoneNumberFormField from "../components/forms/PhoneNumberFormField";
import SearchablePicker from "../components/SearchablePicker"; import SearchablePicker from "../components/SearchablePicker";
import ConfirmationModal from "../components/ConfirmationModal"; import ConfirmationModal from "../components/ConfirmationModal";
import { loginByUsernamAnswers, existUsername } from "../api/auth"; import { loginByUsernamAnswers, existUsername } from "../api/auth";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
function SecQuestionPicker({ name }) { function SecQuestionPicker({ name }) {
const [items, setItems] = useState([ const [items, setItems] = useState([
@ -67,7 +68,6 @@ const validationSchema = Yup.object().shape({
export default function PasswordRecovery({ navigation, route }) { export default function PasswordRecovery({ navigation, route }) {
const user = route.params.user; const user = route.params.user;
console.log(user)
const [showLoading, setShowLoading] = useState(false); const [showLoading, setShowLoading] = useState(false);
const [confirmatioModalData, setConfirmatioModalData] = useState({ const [confirmatioModalData, setConfirmatioModalData] = useState({
@ -78,8 +78,8 @@ export default function PasswordRecovery({ navigation, route }) {
const handleSubmit = async (number, answer, secQuestion) => { const handleSubmit = async (number, answer, secQuestion) => {
setShowLoading(true); setShowLoading(true);
setTimeout(() => { setTimeout(() => {
console.log("to rodando", showLoading)
showLoading && setConfirmatioModalData({
showLoading &&
setConfirmatioModalData({
message: "Validando informações", message: "Validando informações",
show: true, show: true,
}); });
@ -104,7 +104,6 @@ export default function PasswordRecovery({ navigation, route }) {
switch (apiResponse.status) { switch (apiResponse.status) {
case 200: case 200:
console.log("ir pra proxima tela....");
navigation.navigate("PasswordRecoveryChangePswd", { navigation.navigate("PasswordRecoveryChangePswd", {
authToken: apiResponse.data, authToken: apiResponse.data,
username: number, username: number,
@ -142,6 +141,7 @@ export default function PasswordRecovery({ navigation, route }) {
} }
/> />
<KeyboardAwareScrollView>
<Form <Form
validationSchema={validationSchema} validationSchema={validationSchema}
initialValues={{ initialValues={{
@ -187,6 +187,7 @@ export default function PasswordRecovery({ navigation, route }) {
<SubmitButton title="próximo" backgroundColor={colors.primary} /> <SubmitButton title="próximo" backgroundColor={colors.primary} />
</Form> </Form>
</KeyboardAwareScrollView>
</View> </View>
); );
} }

Loading…
Cancel
Save