on master help sign in
activate-ux: skip fade in when going back in flow

fixes #688

commite07ab5745e4da0bd828aa397f707ae94bdec03f6 authortomholford <tomholford@users.noreply.github.com> dateMon 1 Nov 2021, 20:25 (5 years ago) parentf33e9cd
2 files changed+20−8
src/views/Activate/MasterKeyConfirm.tsx+1−1 src/views/Activate/MasterKeyDownload.tsx+19−7
src/views/Activate/MasterKeyConfirm.tsx+1−1
@@ -69,7 +69,7 @@ const MasterKeyConfirm = () => {
6969 const goBack = useCallback(async () => {
7070 setIsIn(false);
7171 await timeout(DEFAULT_FADE_TIMEOUT); // Pause for UI fade animation
72− push(names.DOWNLOAD);
72+ push(names.DOWNLOAD, { skipAnimationDelay: true });
7373 }, [names.DOWNLOAD, push, setIsIn]);
7474
7575 const header = useMemo(() => {
src/views/Activate/MasterKeyDownload.tsx+19−7
@@ -29,7 +29,7 @@ const MasterKeyDownload = () => {
2929 setGenerated,
3030 setIsIn,
3131 } = useActivateFlow();
32− const { push, names } = useLocalRouter();
32+ const { data, push, names } = useLocalRouter();
3333 const point = need.point(derivedPoint);
3434 const wallet = need.wallet(derivedWallet);
3535 const ticket = wallet.ticket;
@@ -37,6 +37,10 @@ const MasterKeyDownload = () => {
3737 const [paper, setPaper] = useState(Nothing());
3838 const [triggerAnimation, setTriggerAnimation] = useState<boolean>(false);
3939
40+ const skipAnimationDelay = useMemo(() => {
41+ return data?.skipAnimationDelay ? true : false;
42+ }, [data]);
43+
4044 const pointAsString = derivedPoint.matchWith({
4145 Nothing: () => '',
4246 Just: p => p.value.toFixed(),
@@ -89,20 +93,28 @@ const MasterKeyDownload = () => {
8993 );
9094 }, [onDownloadClick]);
9195
92− const delayedReveal = useCallback(async () => {
96+ const fadeIn = useCallback(() => {
97+ setTriggerAnimation(true);
98+ setIsIn(true);
99+ }, [setIsIn]);
100+
101+ const delayedFadeIn = useCallback(async () => {
93102 setTimeout(() => {
94− setTriggerAnimation(true);
95− setIsIn(true);
103+ fadeIn();
96104 }, MASTER_KEY_DURATION);
97− }, [setIsIn]);
105+ }, [fadeIn]);
98106
99107 useEffect(() => {
100− delayedReveal();
108+ if (skipAnimationDelay) {
109+ fadeIn();
110+ } else {
111+ delayedFadeIn();
112+ }
101113
102114 return () => {
103115 setIsIn(false);
104116 };
105− }, [delayedReveal, setIsIn]);
117+ }, [delayedFadeIn, fadeIn, setIsIn, skipAnimationDelay]);
106118
107119 return (
108120 <View centered={true}>