-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve textinput performance in login and account creation (#4673)
* Change login form to use uncontrolled inputs * Debounce state updates in account creation to reduce flicker * Refactor state-control of account creation forms to fix perf without relying on debounces * Remove canNext and enforce is13 * Re-add live validation to signup form (#4720) * Update validation in real time * Disable on invalid * Clear server error on typing * Remove unnecessary clearing of error --------- Co-authored-by: Dan Abramov <[email protected]>
- Loading branch information
Showing
7 changed files
with
357 additions
and
269 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react' | ||
import {View} from 'react-native' | ||
import {msg, Trans} from '@lingui/macro' | ||
import {useLingui} from '@lingui/react' | ||
|
||
import {atoms as a} from '#/alf' | ||
import {Button, ButtonIcon, ButtonText} from '#/components/Button' | ||
import {Loader} from '#/components/Loader' | ||
|
||
export interface BackNextButtonsProps { | ||
hideNext?: boolean | ||
showRetry?: boolean | ||
isLoading: boolean | ||
isNextDisabled?: boolean | ||
onBackPress: () => void | ||
onNextPress?: () => void | ||
onRetryPress?: () => void | ||
} | ||
|
||
export function BackNextButtons({ | ||
hideNext, | ||
showRetry, | ||
isLoading, | ||
isNextDisabled, | ||
onBackPress, | ||
onNextPress, | ||
onRetryPress, | ||
}: BackNextButtonsProps) { | ||
const {_} = useLingui() | ||
|
||
return ( | ||
<View style={[a.flex_row, a.justify_between, a.pb_lg, a.pt_3xl]}> | ||
<Button | ||
label={_(msg`Go back to previous step`)} | ||
variant="solid" | ||
color="secondary" | ||
size="medium" | ||
onPress={onBackPress}> | ||
<ButtonText> | ||
<Trans>Back</Trans> | ||
</ButtonText> | ||
</Button> | ||
{!hideNext && | ||
(showRetry ? ( | ||
<Button | ||
label={_(msg`Press to retry`)} | ||
variant="solid" | ||
color="primary" | ||
size="medium" | ||
onPress={onRetryPress}> | ||
<ButtonText> | ||
<Trans>Retry</Trans> | ||
</ButtonText> | ||
{isLoading && <ButtonIcon icon={Loader} />} | ||
</Button> | ||
) : ( | ||
<Button | ||
testID="nextBtn" | ||
label={_(msg`Continue to next step`)} | ||
variant="solid" | ||
color="primary" | ||
size="medium" | ||
disabled={isLoading || isNextDisabled} | ||
onPress={onNextPress}> | ||
<ButtonText> | ||
<Trans>Next</Trans> | ||
</ButtonText> | ||
{isLoading && <ButtonIcon icon={Loader} />} | ||
</Button> | ||
))} | ||
</View> | ||
) | ||
} |
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
Oops, something went wrong.