Skip to content

Commit 450295c

Browse files
authored
Merge pull request #162 from steph-crown/fix/remove-type--casts
refactor(navigation): remove unsafe as never casts and align HomeStac…
2 parents 6976c3d + b325b2a commit 450295c

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/navigation/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type RootStackParamList = {
55
AddSubscription: undefined;
66
SubscriptionDetail: { id: string };
77
WalletConnect: undefined;
8-
CryptoPayment: { subscriptionId?: string };
8+
CryptoPayment: { subscriptionId?: string } | undefined;
99
Analytics: undefined;
1010
Settings: undefined;
1111
};

src/screens/HomeScreen.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const HomeScreen: React.FC = () => {
7272
<StatsCard
7373
totalMonthlySpend={stats.totalMonthlySpend}
7474
totalActive={stats.totalActive}
75-
onWalletPress={() => navigation.navigate('WalletConnect' as never)}
75+
onWalletPress={() => navigation.navigate('WalletConnect')}
7676
/>
7777

7878
<SubscriptionList
@@ -85,13 +85,13 @@ const HomeScreen: React.FC = () => {
8585
totalCount={subscriptions.length}
8686
onSubscriptionPress={(sub) => navigation.navigate('SubscriptionDetail', { id: sub.id })}
8787
onToggleStatus={handleToggleStatus}
88-
onAddFirstPress={() => navigation.navigate('AddSubscription' as never)}
88+
onAddFirstPress={() => navigation.navigate('AddSubscription')}
8989
/>
9090
</ScrollView>
9191

9292
{subscriptions.length > 0 && (
9393
<FloatingActionButton
94-
onPress={() => navigation.navigate('AddSubscription' as never)}
94+
onPress={() => navigation.navigate('AddSubscription')}
9595
icon="+"
9696
size="large"
9797
/>

src/screens/WalletConnectScreen.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ import {
1111
Platform,
1212
} from 'react-native';
1313
import { useNavigation } from '@react-navigation/native';
14+
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
1415
import { colors, spacing, typography, borderRadius, shadows } from '../utils/constants';
1516
import { Button } from '../components/common/Button';
1617
import { Card } from '../components/common/Card';
1718
import { useAppKit, useAppKitAccount, useAppKitProvider } from '@reown/appkit-ethers-react-native';
1819
import walletServiceManager, { WalletConnection, TokenBalance } from '../services/walletService';
1920
import { useWalletStore } from '../store';
21+
import { RootStackParamList } from '../navigation/types';
2022

2123
import * as Clipboard from 'expo-clipboard';
2224

2325
const WalletConnectScreen: React.FC = () => {
24-
const navigation = useNavigation();
26+
const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
2527
const { open } = useAppKit();
2628
const { address, isConnected, chainId } = useAppKitAccount();
2729
const { walletProvider } = useAppKitProvider();
@@ -136,7 +138,7 @@ const WalletConnectScreen: React.FC = () => {
136138

137139
const handleSetupCryptoPayments = () => {
138140
if (connection) {
139-
navigation.navigate('CryptoPayment' as never);
141+
navigation.navigate('CryptoPayment');
140142
} else {
141143
Alert.alert('Error', 'Please connect a wallet first');
142144
}

0 commit comments

Comments
 (0)