-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(auth2): Remove KeyboardAvoidingView to get around iOS 17 bug (#10896
- Loading branch information
Showing
8 changed files
with
61 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,15 @@ import { useRecaptcha } from "app/Components/Recaptcha/Recaptcha" | |
import { AuthContext } from "app/Scenes/Onboarding/Auth2/AuthContext" | ||
import { useAuthNavigation } from "app/Scenes/Onboarding/Auth2/hooks/useAuthNavigation" | ||
import { useInputAutofocus } from "app/Scenes/Onboarding/Auth2/hooks/useInputAutofocus" | ||
import { waitForSubmit } from "app/Scenes/Onboarding/Auth2/utils/waitForSubmit" | ||
import { AuthPromiseRejectType, AuthPromiseResolveType } from "app/store/AuthModel" | ||
import { GlobalStore } from "app/store/GlobalStore" | ||
import { navigate } from "app/system/navigation/navigate" | ||
import { osMajorVersion } from "app/utils/platformUtil" | ||
import { Formik, useFormikContext } from "formik" | ||
import { MotiView } from "moti" | ||
import React, { useRef, useState } from "react" | ||
import { Alert, Image, InteractionManager, Keyboard, Platform } from "react-native" | ||
import { Alert, Image, InteractionManager, Platform } from "react-native" | ||
import { Easing } from "react-native-reanimated" | ||
import * as Yup from "yup" | ||
|
||
interface LoginEmailFormValues { | ||
|
@@ -47,8 +48,6 @@ export const LoginWelcomeStep: React.FC = () => { | |
.required("Email field is required"), | ||
})} | ||
onSubmit={async ({ email }, { resetForm }) => { | ||
Keyboard.dismiss() | ||
|
||
// FIXME | ||
if (!token) { | ||
Alert.alert("Something went wrong. Please try again, or contact [email protected]") | ||
|
@@ -57,8 +56,6 @@ export const LoginWelcomeStep: React.FC = () => { | |
|
||
const res = await GlobalStore.actions.auth.verifyUser({ email, recaptchaToken: token }) | ||
|
||
await waitForSubmit() | ||
|
||
if (res === "user_exists") { | ||
navigation.navigate({ name: "LoginPasswordStep", params: { email } }) | ||
} else if (res === "user_does_not_exist") { | ||
|
@@ -119,6 +116,7 @@ const LoginWelcomeStepForm: React.FC = () => { | |
autoCapitalize="none" | ||
autoComplete="email" | ||
autoCorrect={false} | ||
blurOnSubmit={false} | ||
error={errors.email} | ||
placeholderTextColor={color("black30")} | ||
ref={emailRef} | ||
|
@@ -135,15 +133,25 @@ const LoginWelcomeStepForm: React.FC = () => { | |
onSubmitEditing={handleSubmit} | ||
/> | ||
|
||
<Flex display={isModalExpanded ? "flex" : "none"}> | ||
<MotiView | ||
from={{ opacity: isModalExpanded ? 0 : 1 }} | ||
animate={{ opacity: isModalExpanded ? 1 : 0 }} | ||
transition={{ type: "timing", duration: 400, easing: Easing.linear }} | ||
style={{ display: isModalExpanded ? "flex" : "none" }} | ||
> | ||
<Spacer y={2} /> | ||
|
||
<Button block width="100%" onPress={handleSubmit} loading={isSubmitting}> | ||
Continue | ||
</Button> | ||
</Flex> | ||
</MotiView> | ||
|
||
<Flex display={isModalExpanded ? "none" : "flex"}> | ||
<MotiView | ||
from={{ opacity: isModalExpanded ? 1 : 0 }} | ||
animate={{ opacity: isModalExpanded ? 0 : 1 }} | ||
transition={{ type: "timing", duration: 400, easing: Easing.linear }} | ||
style={{ display: isModalExpanded ? "none" : "flex" }} | ||
> | ||
<Spacer y={2} /> | ||
|
||
<SocialLoginButtons /> | ||
|
@@ -160,7 +168,7 @@ const LoginWelcomeStepForm: React.FC = () => { | |
Privacy Policy | ||
</LinkText> | ||
</Text> | ||
</Flex> | ||
</MotiView> | ||
</Flex> | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
* Slight delay to smooth out keyboard transitions between submission steps | ||
*/ | ||
export const waitForSubmit = async (delay = 1500) => { | ||
export const waitForSubmit = async (delay = 1000) => { | ||
return new Promise((resolve: any) => setTimeout(resolve, delay)) | ||
} |