Skip to content

Commit

Permalink
fix(HW-667): fix hardware button navigation (#2099)
Browse files Browse the repository at this point in the history
Co-authored-by: iGroza <[email protected]>
  • Loading branch information
2 people authored and devkudasov committed Sep 17, 2024
1 parent a0ee48e commit f134188
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/screens/WelcomeStack/SignInStack/signin-networks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {getMetadataValueWrapped} from '@app/helpers/wrappers/get-metadata-value'
import {useTypedNavigation} from '@app/hooks';
import {ErrorHandler} from '@app/models/error-handler';
import {
HomeStackParamList,
HomeStackRoutes,
SignInStackParamList,
SignInStackRoutes,
WelcomeStackRoutes,
Expand All @@ -27,7 +29,9 @@ import {
import {RemoteConfig} from '@app/services/remote-config';

export const SignInNetworksScreen = memo(() => {
const navigation = useTypedNavigation<SignInStackParamList>();
const navigation = useTypedNavigation<
SignInStackParamList & HomeStackParamList
>();

const onLogin = useCallback(
async (provider: SssProviders, skipCheck: boolean = false) => {
Expand Down Expand Up @@ -139,7 +143,9 @@ export const SignInNetworksScreen = memo(() => {
}, [navigation]);

const onPressHardwareWallet = useCallback(() => {
navigation.navigate(WelcomeStackRoutes.Device);
navigation.navigate(
app.onboarded ? HomeStackRoutes.Device : WelcomeStackRoutes.Device,
);
}, [navigation]);

return (
Expand Down
10 changes: 8 additions & 2 deletions src/screens/WelcomeStack/SignUpStack/signup-agreement.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React, {memo, useCallback} from 'react';

import {CreateAgreement} from '@app/components/create-agreement';
import {app} from '@app/contexts';
import {useTypedNavigation, useTypedRoute} from '@app/hooks';
import {
HomeStackParamList,
HomeStackRoutes,
SignUpStackParamList,
SignUpStackRoutes,
WelcomeStackRoutes,
Expand All @@ -11,7 +14,7 @@ import {
export const SignUpAgreementScreen = memo(() => {
const navigation = useTypedNavigation<SignUpStackParamList>();
const params = useTypedRoute<
SignUpStackParamList,
SignUpStackParamList & HomeStackParamList,
SignUpStackRoutes.SignUpAgreement
>().params;
const onPressRegularWallet = useCallback(() => {
Expand All @@ -25,7 +28,10 @@ export const SignUpAgreementScreen = memo(() => {
}, [navigation, params.nextScreen]);

const onPressHardwareWallet = () => {
navigation.navigate(WelcomeStackRoutes.Device);
navigation.navigate(
// @ts-ignore
app.onboarded ? HomeStackRoutes.Device : WelcomeStackRoutes.Device,
);
};

return (
Expand Down

0 comments on commit f134188

Please sign in to comment.