-
Notifications
You must be signed in to change notification settings - Fork 3.7k
move 2fa code input out of the bottom section #67762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9e42b6c
dd50508
b69893b
1d49430
aac5e31
beb414a
6813329
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import React, {useEffect, useRef} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import React, {useCallback, useEffect, useRef} from 'react'; | ||
| import {InteractionManager, View} from 'react-native'; | ||
| // eslint-disable-next-line no-restricted-imports | ||
| import type {ScrollView as RNScrollView} from 'react-native'; | ||
| import expensifyLogo from '@assets/images/expensify-logo-round-transparent.png'; | ||
| import Button from '@components/Button'; | ||
| import FixedFooter from '@components/FixedFooter'; | ||
|
|
@@ -70,6 +72,15 @@ function VerifyPage({route}: VerifyPageProps) { | |
| return `otpauth://totp/Expensify:${contactMethod}?secret=${account?.twoFactorAuthSecretKey}&issuer=Expensify`; | ||
| } | ||
|
|
||
| const scrollViewRef = useRef<RNScrollView>(null); | ||
| const handleInputFocus = useCallback(() => { | ||
| InteractionManager.runAfterInteractions(() => { | ||
| requestAnimationFrame(() => { | ||
| scrollViewRef.current?.scrollToEnd({animated: true}); | ||
| }); | ||
| }); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <TwoFactorAuthWrapper | ||
| stepName={CONST.TWO_FACTOR_AUTH_STEPS.VERIFY} | ||
|
|
@@ -80,12 +91,14 @@ function VerifyPage({route}: VerifyPageProps) { | |
| total: 3, | ||
| }} | ||
| onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_2FA_ROOT.getRoute(route.params?.backTo, route.params?.forwardTo))} | ||
| shouldEnableViewportOffsetTop | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still didn't fix iOS safari issue. More details: #75199 (comment)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This functionality worked in the past on older iOS versions Screen.Recording.2025-08-02.at.15.58.27.mp4and the new fix on PR #81812 will cause the navigation to stop sticking to the top & the save button to stop sticking to the bottom while scrolling |
||
| > | ||
| <ScrollView | ||
| ref={scrollViewRef} | ||
| keyboardShouldPersistTaps="handled" | ||
| contentContainerStyle={styles.flexGrow1} | ||
| > | ||
| <View style={[styles.ph5, styles.mt3, styles.flexGrow1]}> | ||
| <View style={[styles.ph5, styles.mt3]}> | ||
| <Text> | ||
| {translate('twoFactorAuth.scanCode')} | ||
| <TextLink href={TROUBLESHOOTING_LINK}> {translate('twoFactorAuth.authenticatorApp')}</TextLink>. | ||
|
|
@@ -116,27 +129,28 @@ function VerifyPage({route}: VerifyPageProps) { | |
| </View> | ||
| <Text style={styles.mt11}>{translate('twoFactorAuth.enterCode')}</Text> | ||
| </View> | ||
| <FixedFooter style={[styles.mt2, styles.pt2]}> | ||
| <View style={[styles.mh5, styles.mb4]}> | ||
| <TwoFactorAuthForm | ||
| innerRef={formRef} | ||
| shouldAutoFocusOnMobile={false} | ||
| /> | ||
| </View> | ||
| <Button | ||
| success | ||
| large | ||
| text={translate('common.next')} | ||
| isLoading={account?.isLoading} | ||
| onPress={() => { | ||
| if (!formRef.current) { | ||
| return; | ||
| } | ||
| formRef.current.validateAndSubmitForm(); | ||
| }} | ||
| <View style={[styles.mh5, styles.mb4, styles.mt3]}> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apply the same style at DisablePage |
||
| <TwoFactorAuthForm | ||
| innerRef={formRef} | ||
| shouldAutoFocusOnMobile={false} | ||
| onFocus={handleInputFocus} | ||
| /> | ||
| </FixedFooter> | ||
| </View> | ||
| </ScrollView> | ||
| <FixedFooter style={[styles.mt2, styles.pt2]}> | ||
| <Button | ||
| success | ||
| large | ||
| text={translate('common.next')} | ||
| isLoading={account?.isLoading} | ||
| onPress={() => { | ||
| if (!formRef.current) { | ||
| return; | ||
| } | ||
| formRef.current.validateAndSubmitForm(); | ||
| }} | ||
| /> | ||
| </FixedFooter> | ||
| </TwoFactorAuthWrapper> | ||
| ); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@suneox why was this InteractionManager necessary here? (I'm working on InteractionManager migration and I need to understand the use case)
Thank you in advance!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On iOS/mWeb, we trigger a scroll to the bottom to handle the issue keyboard above input