Skip to content

Commit c5c3e71

Browse files
committed
chore: upgrade nav dependencies
1 parent bfa857b commit c5c3e71

File tree

116 files changed

+613
-803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+613
-803
lines changed

e2e/backup.e2e.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ d('Backup', () => {
121121
element(by.id(`Tag-${tag}`).withAncestor(by.id('ActivityTags'))),
122122
).toBeVisible();
123123
await element(by.id('NavigationClose')).atIndex(0).tap();
124+
await sleep(200); // animation
124125

125126
// check widgets
126127
await element(by.id('WalletsScrollView')).scroll(300, 'down', NaN, 0.85);

e2e/channels.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ d('Transfer', () => {
107107
let { label } = await element(
108108
by.id('SpendingAdvancedNumberField'),
109109
).getAttributes();
110-
const lspBalance = Number.parseInt(label);
110+
const lspBalance = Number.parseInt(label, 10);
111111
jestExpect(lspBalance).toBeGreaterThan(440);
112112
jestExpect(lspBalance).toBeLessThan(460);
113113
await element(by.id('SpendingAdvancedNumberField')).tap();

ios/Podfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ PODS:
3131
- ReactCommon/turbomodule/bridging
3232
- ReactCommon/turbomodule/core
3333
- Yoga
34-
- MMKV (1.3.7):
35-
- MMKVCore (~> 1.3.7)
36-
- MMKVCore (1.3.7)
34+
- MMKV (2.0.0):
35+
- MMKVCore (~> 2.0.0)
36+
- MMKVCore (2.0.0)
3737
- OpenSSL-Universal (3.3.2000)
3838
- RCT-Folly (2024.01.01.00):
3939
- boost
@@ -1423,7 +1423,7 @@ PODS:
14231423
- Yoga
14241424
- react-native-restart (0.0.27):
14251425
- React-Core
1426-
- react-native-safe-area-context (4.10.9):
1426+
- react-native-safe-area-context (5.0.0):
14271427
- React-Core
14281428
- react-native-skia (1.3.11):
14291429
- DoubleConversion
@@ -1842,7 +1842,7 @@ PODS:
18421842
- ReactCommon/turbomodule/bridging
18431843
- ReactCommon/turbomodule/core
18441844
- Yoga
1845-
- RNScreens (3.34.0):
1845+
- RNScreens (4.3.0):
18461846
- DoubleConversion
18471847
- glog
18481848
- hermes-engine
@@ -2216,8 +2216,8 @@ SPEC CHECKSUMS:
22162216
hermes-engine: 3b6e0717ca847e2fc90a201e59db36caf04dee88
22172217
lottie-ios: e047b1d2e6239b787cc5e9755b988869cf190494
22182218
lottie-react-native: 31197e5c65aa7cb59e6affcefaf901588bb708c4
2219-
MMKV: 36a22a9ec84c9bb960613a089ddf6f48be9312b0
2220-
MMKVCore: 158e61c8516401a9fac730288acb29e6fc19bbf9
2219+
MMKV: f7d1d5945c8765f97f39c3d121f353d46735d801
2220+
MMKVCore: c04b296010fcb1d1638f2c69405096aac12f6390
22212221
OpenSSL-Universal: b60a3702c9fea8b3145549d421fdb018e53ab7b4
22222222
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
22232223
RCTDeprecation: 34cbf122b623037ea9facad2e92e53434c5c7422
@@ -2259,7 +2259,7 @@ SPEC CHECKSUMS:
22592259
react-native-quick-base64: f98f17faf04c9779faf726921a2b389d4775e8b6
22602260
react-native-quick-crypto: 12de8e1666ad3dab6339418c14f4a6de71716194
22612261
react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162
2262-
react-native-safe-area-context: ab8f4a3d8180913bd78ae75dd599c94cce3d5e9a
2262+
react-native-safe-area-context: ab7beb734b0f9f79f55ae144a6c946a6422f55d6
22632263
react-native-skia: 68be40d53b1957f6c276cec19bcd50d293173868
22642264
react-native-tcp-socket: e724380c910c2e704816ec817ed28f1342246ff7
22652265
React-nativeconfig: 57781b79e11d5af7573e6f77cbf1143b71802a6d
@@ -2301,7 +2301,7 @@ SPEC CHECKSUMS:
23012301
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
23022302
RNReactNativeHapticFeedback: ec56a5f81c3941206fd85625fa669ffc7b4545f9
23032303
RNReanimated: 74413c59c47123d7144db601d065627c75c746a3
2304-
RNScreens: 19719a9c326e925498ac3b2d35c4e50fe87afc06
2304+
RNScreens: b03d696c70cc5235ce4587fcc27ae1a93a48f98c
23052305
RNShare: 554a91f5cfbe4adac4cfe3654826ee8b299fe365
23062306
RNSVG: 43b64ed39c14ce830d840903774154ca0c1f27ec
23072307
RNZipArchive: 7bb4c70d6aa2dd235212c0a4a3de0a4e237e2569

ios/bitkit.xcodeproj/project.pbxproj

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"start": "react-native start",
77
"android": "react-native run-android",
8-
"ios": "react-native run-ios --simulator='iPhone 15'",
8+
"ios": "react-native run-ios --simulator='iPhone 16'",
99
"ios:se": "react-native run-ios --simulator='iPhone SE (3rd generation)'",
1010
"test": "jest --forceExit",
1111
"test:coverage": "jest --forceExit --coverage=true",
@@ -42,8 +42,8 @@
4242
"@react-native-clipboard/clipboard": "1.14.1",
4343
"@react-native-community/blur": "4.4.0",
4444
"@react-native-community/netinfo": "11.3.1",
45-
"@react-navigation/native": "6.1.18",
46-
"@react-navigation/native-stack": "6.10.1",
45+
"@react-navigation/native": "7.0.14",
46+
"@react-navigation/native-stack": "7.2.0",
4747
"@reduxjs/toolkit": "2.2.6",
4848
"@shopify/react-native-skia": "1.3.11",
4949
"@synonymdev/blocktank-lsp-http-client": "2.2.0",
@@ -104,8 +104,8 @@
104104
"react-native-reanimated": "3.15.0",
105105
"react-native-reanimated-carousel": "3.5.1",
106106
"react-native-restart": "0.0.27",
107-
"react-native-safe-area-context": "4.10.9",
108-
"react-native-screens": "3.34.0",
107+
"react-native-safe-area-context": "5.0.0",
108+
"react-native-screens": "4.3.0",
109109
"react-native-share": "10.2.0",
110110
"react-native-svg": "15.2.0",
111111
"react-native-tcp-socket": "6.0.6",

src/components/BottomSheetNavigationHeader.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ import NavigationHeader, {
55
NavigationHeaderProps,
66
} from '../components/NavigationHeader';
77

8-
type Props = Omit<NavigationHeaderProps, 'size'> & { title: string };
8+
type Props = Omit<NavigationHeaderProps, 'size' | 'showCloseButton'> & {
9+
title: string;
10+
};
911

1012
const BottomSheetNavigationHeader = (props: Props): ReactElement => (
11-
<NavigationHeader size="sm" style={styles.container} {...props} />
13+
<NavigationHeader
14+
style={styles.container}
15+
size="sm"
16+
{...props}
17+
showCloseButton={false}
18+
/>
1219
);
1320

1421
const styles = StyleSheet.create({

src/components/BottomSheetScreen.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const BottomSheetScreen = ({
1919
image,
2020
continueText,
2121
cancelText,
22-
displayBackButton = true,
22+
showBackButton = true,
2323
isLoading,
2424
testID,
2525
onCancel,
@@ -31,7 +31,7 @@ const BottomSheetScreen = ({
3131
image: ImageSourcePropType;
3232
continueText: string;
3333
cancelText?: string;
34-
displayBackButton?: boolean;
34+
showBackButton?: boolean;
3535
isLoading?: boolean;
3636
testID?: string;
3737
onCancel?: () => void;
@@ -50,7 +50,7 @@ const BottomSheetScreen = ({
5050
<View style={styles.root} testID={testID} onLayout={onLayout}>
5151
<BottomSheetNavigationHeader
5252
title={navTitle}
53-
displayBackButton={displayBackButton}
53+
showBackButton={showBackButton}
5454
/>
5555
<View style={styles.content}>
5656
<View

src/components/InfoScreen.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ const InfoScreen = ({
1313
description,
1414
image,
1515
buttonText,
16-
displayBackButton = true,
16+
showBackButton = true,
17+
showCloseButton = true,
1718
testID,
18-
onClosePress,
1919
onButtonPress,
2020
}: {
2121
navTitle: string;
2222
title: string | ReactElement;
2323
description: string | ReactElement;
2424
image: ImageSourcePropType;
2525
buttonText: string;
26-
displayBackButton?: boolean;
26+
showBackButton?: boolean;
27+
showCloseButton?: boolean;
2728
testID?: string;
28-
onClosePress?: () => void;
2929
onButtonPress: () => void;
3030
}): ReactElement => {
3131
return (
3232
<ThemedView style={styles.root}>
3333
<SafeAreaInset type="top" />
3434
<NavigationHeader
3535
title={navTitle}
36-
displayBackButton={displayBackButton}
37-
onClosePress={onClosePress}
36+
showBackButton={showBackButton}
37+
showCloseButton={showCloseButton}
3838
/>
3939
<View style={styles.content} testID={testID}>
4040
<Display>{title}</Display>

src/components/NavigationHeader.tsx

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Subtitle, Title } from '../styles/text';
1212
import { BackIcon, XIcon } from '../styles/icons';
1313
import { Keyboard } from '../hooks/keyboard';
1414
import { Pressable } from '../styles/components';
15+
import { RootNavigationProp } from '../navigation/types';
1516

1617
export const HEADER_HEIGHT = 46;
1718

@@ -49,38 +50,55 @@ const ACTION_WIDTH = 45;
4950
export type NavigationHeaderProps = {
5051
title?: string;
5152
icon?: ReactElement;
52-
displayBackButton?: boolean;
53-
navigateBack?: boolean;
53+
showBackButton?: boolean;
54+
showCloseButton?: boolean;
5455
actionIcon?: ReactElement;
5556
size?: 'lg' | 'sm';
5657
style?: StyleProp<ViewStyle>;
5758
onBackPress?: () => void;
58-
onClosePress?: () => void;
5959
onActionPress?: () => void;
6060
};
6161

6262
const NavigationHeader = ({
6363
title = ' ',
6464
icon,
65-
displayBackButton = true,
66-
navigateBack = true,
65+
showBackButton = true,
66+
showCloseButton = true,
6767
size = 'lg',
6868
actionIcon,
6969
style,
7070
onBackPress,
71-
onClosePress,
7271
onActionPress,
7372
}: NavigationHeaderProps): ReactElement => {
74-
const navigation = useNavigation<any>();
73+
const navigation = useNavigation<RootNavigationProp>();
7574

7675
const handleBackPress = useCallback(async () => {
77-
onBackPress?.();
78-
if (navigateBack) {
79-
// make sure Keyboard is closed before navigating back to prevent layout bugs
80-
await Keyboard.dismiss();
76+
// make sure Keyboard is closed before navigating back to prevent layout bugs
77+
await Keyboard.dismiss();
78+
79+
if (onBackPress) {
80+
onBackPress();
81+
} else {
8182
navigation.goBack();
8283
}
83-
}, [navigation, navigateBack, onBackPress]);
84+
}, [navigation, onBackPress]);
85+
86+
const handleClosePress = useCallback(async () => {
87+
const parent = navigation.getParent?.();
88+
const state = navigation.getState?.();
89+
const routeNames = state?.routes.map((route) => route.name);
90+
const hasWalletRoute = routeNames?.includes('Wallet');
91+
92+
// make sure Keyboard is closed before navigating back to prevent layout bugs
93+
await Keyboard.dismiss();
94+
95+
if (hasWalletRoute || parent) {
96+
// for nested navigators, pop to top of parent navigator
97+
navigation.popTo('Wallet', { screen: 'Wallets' });
98+
} else {
99+
navigation.popToTop();
100+
}
101+
}, [navigation]);
84102

85103
const Text = useMemo(() => (size === 'lg' ? Title : Subtitle), [size]);
86104
const container = useMemo(
@@ -92,18 +110,20 @@ const NavigationHeader = ({
92110
[size, style],
93111
);
94112

95-
// TODO: this doesn't have the right navigator
96-
const showBack = Boolean(displayBackButton && navigation.canGoBack());
113+
const state = navigation.getState?.();
114+
const parent = navigation.getParent?.();
115+
const canGoBack = state?.routes.length > 1 || parent;
116+
const showBack = showBackButton && canGoBack;
97117

98118
const numberOfActions = useMemo(() => {
99-
if (actionIcon && onClosePress) {
119+
if (actionIcon && showCloseButton) {
100120
return 2;
101-
} else if (showBack || actionIcon || onClosePress) {
121+
} else if (showBack || actionIcon || showCloseButton) {
102122
return 1;
103123
} else {
104124
return 0;
105125
}
106-
}, [actionIcon, onClosePress, showBack]);
126+
}, [actionIcon, showBack, showCloseButton]);
107127

108128
const actionColumn = useMemo(
109129
() => [
@@ -146,11 +166,11 @@ const NavigationHeader = ({
146166
{actionIcon}
147167
</ActionButton>
148168
)}
149-
{onClosePress && (
169+
{showCloseButton && (
150170
<ActionButton
151171
style={styles.actionRight}
152172
testID="NavigationClose"
153-
onPress={onClosePress}>
173+
onPress={handleClosePress}>
154174
<XIcon width={24} height={24} />
155175
</ActionButton>
156176
)}

src/components/OnboardingScreen.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ const OnboardingScreen = ({
1414
image,
1515
imagePosition,
1616
buttonText,
17-
displayBackButton = true,
17+
showBackButton = true,
18+
showCloseButton = true,
1819
disableNav = false,
1920
mirrorImage = false,
2021
testID,
21-
onClosePress,
2222
onButtonPress,
2323
}: {
2424
navTitle?: string;
@@ -27,11 +27,11 @@ const OnboardingScreen = ({
2727
image: ImageSourcePropType;
2828
imagePosition?: 'center' | 'bottom';
2929
buttonText: string;
30-
displayBackButton?: boolean;
30+
showBackButton?: boolean;
31+
showCloseButton?: boolean;
3132
disableNav?: boolean;
3233
mirrorImage?: boolean;
3334
testID?: string;
34-
onClosePress?: () => void;
3535
onButtonPress: () => void;
3636
}): ReactElement => {
3737
return (
@@ -42,8 +42,8 @@ const OnboardingScreen = ({
4242
) : (
4343
<NavigationHeader
4444
title={navTitle}
45-
displayBackButton={displayBackButton}
46-
onClosePress={onClosePress}
45+
showBackButton={showBackButton}
46+
showCloseButton={showCloseButton}
4747
/>
4848
)}
4949

0 commit comments

Comments
 (0)