Skip to content

Commit f81067d

Browse files
perf: manually inline navigation screen requires
1 parent febe5e6 commit f81067d

7 files changed

Lines changed: 691 additions & 397 deletions

File tree

src/features/ens/navigation/RegisterENSNavigator.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ import deviceUtils from '@/utils/deviceUtils';
1717
import { avatarMetadataAtom } from '../components/registration/RegistrationAvatar';
1818
import useENSRegistration from '../hooks/useENSRegistration';
1919
import useENSRegistrationForm from '../hooks/useENSRegistrationForm';
20-
import ENSAssignRecordsSheet, { ENSAssignRecordsBottomActions } from '../screens/ENSAssignRecordsSheet';
21-
import ENSIntroSheet from '../screens/ENSIntroSheet';
22-
import ENSSearchSheet from '../screens/ENSSearchSheet';
20+
import { ENSAssignRecordsBottomActions } from '../screens/ENSAssignRecordsSheet';
2321
import { accentColorAtom, REGISTRATION_MODES } from '../utils/helpers';
2422

2523
const Swipe = createMaterialTopTabNavigator();
@@ -132,7 +130,7 @@ export default function RegisterENSNavigator() {
132130
screenOptions={{ swipeEnabled: false }}
133131
>
134132
<Swipe.Screen
135-
getComponent={() => ENSIntroSheet}
133+
getComponent={() => require('../screens/ENSIntroSheet').default}
136134
initialParams={{
137135
contentHeight,
138136
onSearchForNewName: () => setIsSearchEnabled(true),
@@ -147,15 +145,15 @@ export default function RegisterENSNavigator() {
147145
/>
148146
{isSearchEnabled && (
149147
<Swipe.Screen
150-
getComponent={() => ENSSearchSheet}
148+
getComponent={() => require('../screens/ENSSearchSheet').default}
151149
listeners={{
152150
focus: () => setCurrentRouteName(Routes.ENS_SEARCH_SHEET),
153151
}}
154152
name={Routes.ENS_SEARCH_SHEET}
155153
/>
156154
)}
157155
<Swipe.Screen
158-
getComponent={() => ENSAssignRecordsSheet}
156+
getComponent={() => require('../screens/ENSAssignRecordsSheet').default}
159157
initialParams={{
160158
autoFocusKey: params?.autoFocusKey,
161159
mode: params?.mode,

src/navigation/AddWalletNavigator.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import { useRoute, type RouteProp } from '@react-navigation/native';
66
import { SimpleSheet } from '@/components/sheet/SimpleSheet';
77
import { BackgroundProvider } from '@/design-system';
88
import Routes from '@/navigation/routesNames';
9-
import { AddWalletSheet } from '@/screens/AddWalletSheet';
10-
import { ChooseWalletGroup } from '@/screens/ChooseWalletGroup';
11-
import { ImportOrWatchWalletSheet } from '@/screens/ImportOrWatchWalletSheet';
129
import { setActiveRoute } from '@/state/navigation/navigationStore';
1310
import deviceUtils from '@/utils/deviceUtils';
1411

@@ -34,7 +31,7 @@ export const AddWalletNavigator = () => {
3431
tabBar={() => null}
3532
>
3633
<Swipe.Screen
37-
getComponent={() => AddWalletSheet}
34+
getComponent={() => require('@/screens/AddWalletSheet').AddWalletSheet}
3835
initialParams={{ flowContext, isFirstWallet }}
3936
name={Routes.ADD_WALLET_SHEET}
4037
listeners={{
@@ -45,7 +42,7 @@ export const AddWalletNavigator = () => {
4542
}}
4643
/>
4744
<Swipe.Screen
48-
getComponent={() => ChooseWalletGroup}
45+
getComponent={() => require('@/screens/ChooseWalletGroup').ChooseWalletGroup}
4946
initialParams={{ isFirstWallet }}
5047
name={Routes.CHOOSE_WALLET_GROUP}
5148
listeners={{
@@ -56,7 +53,7 @@ export const AddWalletNavigator = () => {
5653
}}
5754
/>
5855
<Swipe.Screen
59-
getComponent={() => ImportOrWatchWalletSheet}
56+
getComponent={() => require('@/screens/ImportOrWatchWalletSheet').ImportOrWatchWalletSheet}
6057
initialParams={{ flowContext, type }}
6158
name={Routes.IMPORT_OR_WATCH_WALLET_SHEET}
6259
listeners={{

src/navigation/HardwareWalletTxNavigator.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { useLedgerConnect } from '@/hooks/useLedgerConnect';
1212
import { logger } from '@/logger';
1313
import { useNavigation } from '@/navigation/Navigation';
1414
import Routes from '@/navigation/routesNames';
15-
import { PairHardwareWalletAgainSheet } from '@/screens/hardware-wallets/PairHardwareWalletAgainSheet';
16-
import { PairHardwareWalletErrorSheet } from '@/screens/hardware-wallets/PairHardwareWalletErrorSheet';
1715
import { useSelectedWallet } from '@/state/wallets/walletsStore';
1816
import { LEDGER_ERROR_CODES } from '@/utils/ledger';
1917

@@ -119,8 +117,14 @@ export const HardwareWalletTxNavigator = () => {
119117
sceneContainerStyle={{ backgroundColor: backgroundColor }}
120118
tabBar={() => null}
121119
>
122-
<Swipe.Screen getComponent={() => PairHardwareWalletAgainSheet} name={Routes.PAIR_HARDWARE_WALLET_AGAIN_SHEET} />
123-
<Swipe.Screen getComponent={() => PairHardwareWalletErrorSheet} name={Routes.PAIR_HARDWARE_WALLET_ERROR_SHEET} />
120+
<Swipe.Screen
121+
getComponent={() => require('@/screens/hardware-wallets/PairHardwareWalletAgainSheet').PairHardwareWalletAgainSheet}
122+
name={Routes.PAIR_HARDWARE_WALLET_AGAIN_SHEET}
123+
/>
124+
<Swipe.Screen
125+
getComponent={() => require('@/screens/hardware-wallets/PairHardwareWalletErrorSheet').PairHardwareWalletErrorSheet}
126+
name={Routes.PAIR_HARDWARE_WALLET_ERROR_SHEET}
127+
/>
124128
</Swipe.Navigator>
125129
</SimpleSheet>
126130
)}

src/navigation/PairHardwareWalletNavigator.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import { BackgroundProvider } from '@/design-system';
1010
import useDimensions from '@/hooks/useDimensions';
1111
import Routes from '@/navigation/routesNames';
1212
import { NanoXDeviceAnimation } from '@/screens/hardware-wallets/components/NanoXDeviceAnimation';
13-
import { PairHardwareWalletIntroSheet } from '@/screens/hardware-wallets/PairHardwareWalletIntroSheet';
14-
import { PairHardwareWalletSearchSheet } from '@/screens/hardware-wallets/PairHardwareWalletSearchSheet';
15-
import { PairHardwareWalletSigningSheet } from '@/screens/hardware-wallets/PairHardwareWalletSigningSheet';
1613

1714
import { type RootStackParamList } from './types';
1815

@@ -68,7 +65,7 @@ export function PairHardwareWalletNavigator() {
6865
tabBar={() => null}
6966
>
7067
<Swipe.Screen
71-
getComponent={() => PairHardwareWalletIntroSheet}
68+
getComponent={() => require('@/screens/hardware-wallets/PairHardwareWalletIntroSheet').PairHardwareWalletIntroSheet}
7269
name={Routes.PAIR_HARDWARE_WALLET_INTRO_SHEET}
7370
listeners={{
7471
focus: () => {
@@ -77,7 +74,7 @@ export function PairHardwareWalletNavigator() {
7774
}}
7875
/>
7976
<Swipe.Screen
80-
getComponent={() => PairHardwareWalletSearchSheet}
77+
getComponent={() => require('@/screens/hardware-wallets/PairHardwareWalletSearchSheet').PairHardwareWalletSearchSheet}
8178
name={Routes.PAIR_HARDWARE_WALLET_SEARCH_SHEET}
8279
listeners={{
8380
focus: () => {
@@ -86,7 +83,7 @@ export function PairHardwareWalletNavigator() {
8683
}}
8784
/>
8885
<Swipe.Screen
89-
getComponent={() => PairHardwareWalletSigningSheet}
86+
getComponent={() => require('@/screens/hardware-wallets/PairHardwareWalletSigningSheet').PairHardwareWalletSigningSheet}
9087
initialParams={{ flowContext }}
9188
name={Routes.PAIR_HARDWARE_WALLET_SIGNING_SHEET}
9289
listeners={{

0 commit comments

Comments
 (0)