Skip to content

Commit f7c2f7d

Browse files
fix: avoid deprecated object form of CommonActions.navigate on tab press (#538)
* fix(react-navigation): use navigate(name, params) to avoid deprecation warning * chore: bump package versions and add changeset --------- Co-authored-by: Thiago Brezinski <thiagobrez@gmail.com>
1 parent 259472a commit f7c2f7d

5 files changed

Lines changed: 61 additions & 5 deletions

File tree

.changeset/fifty-taxes-go.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@bottom-tabs/react-navigation': patch
3+
---
4+
5+
Fix deprecated object argument on CommonActions.navigate

apps/example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@bottom-tabs/react-navigation": "*",
1515
"@react-navigation/bottom-tabs": "^7.15.9",
1616
"@react-navigation/devtools": "^7.0.44",
17-
"@react-navigation/native": "^7.2.2",
17+
"@react-navigation/native": "^7.3.0",
1818
"@react-navigation/native-stack": "^7.14.11",
1919
"@react-navigation/stack": "^7.8.10",
2020
"color": "^5.0.0",

packages/react-navigation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"access": "public"
5757
},
5858
"devDependencies": {
59-
"@react-navigation/native": "^7.2.2",
59+
"@react-navigation/native": "^7.3.0",
6060
"@types/color": "^4.2.0",
6161
"jest": "^29.7.0",
6262
"react": "^19.1.0",

packages/react-navigation/src/views/NativeBottomTabView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default function NativeBottomTabView({
110110
return;
111111
} else {
112112
navigation.dispatch({
113-
...CommonActions.navigate(route),
113+
...CommonActions.navigate(route.name, route.params),
114114
target: state.key,
115115
});
116116
}

yarn.lock

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,7 +2782,7 @@ __metadata:
27822782
version: 0.0.0-use.local
27832783
resolution: "@bottom-tabs/react-navigation@workspace:packages/react-navigation"
27842784
dependencies:
2785-
"@react-navigation/native": "npm:^7.2.2"
2785+
"@react-navigation/native": "npm:^7.3.0"
27862786
"@types/color": "npm:^4.2.0"
27872787
color: "npm:^5.0.0"
27882788
jest: "npm:^29.7.0"
@@ -5663,6 +5663,24 @@ __metadata:
56635663
languageName: node
56645664
linkType: hard
56655665

5666+
"@react-navigation/core@npm:^7.20.0":
5667+
version: 7.20.0
5668+
resolution: "@react-navigation/core@npm:7.20.0"
5669+
dependencies:
5670+
"@react-navigation/routers": "npm:^7.6.0"
5671+
escape-string-regexp: "npm:^4.0.0"
5672+
fast-deep-equal: "npm:^3.1.3"
5673+
nanoid: "npm:^3.3.11"
5674+
query-string: "npm:^7.1.3"
5675+
react-is: "npm:^19.1.0"
5676+
use-latest-callback: "npm:^0.2.4"
5677+
use-sync-external-store: "npm:^1.5.0"
5678+
peerDependencies:
5679+
react: ">= 18.2.0"
5680+
checksum: 10/037f11520ed52aa5285c9b0dcba414c589643812a494aa819a81342d60adae2adb7e014fb4a76ce36b34630c5eecbc5e0c244e4c191091d03c9c576fa0fbfbbe
5681+
languageName: node
5682+
linkType: hard
5683+
56665684
"@react-navigation/devtools@npm:^7.0.44":
56675685
version: 7.0.44
56685686
resolution: "@react-navigation/devtools@npm:7.0.44"
@@ -5782,6 +5800,23 @@ __metadata:
57825800
languageName: node
57835801
linkType: hard
57845802

5803+
"@react-navigation/native@npm:^7.3.0":
5804+
version: 7.3.1
5805+
resolution: "@react-navigation/native@npm:7.3.1"
5806+
dependencies:
5807+
"@react-navigation/core": "npm:^7.20.0"
5808+
escape-string-regexp: "npm:^4.0.0"
5809+
fast-deep-equal: "npm:^3.1.3"
5810+
nanoid: "npm:^3.3.11"
5811+
standard-navigation: "npm:^0.0.7"
5812+
use-latest-callback: "npm:^0.2.4"
5813+
peerDependencies:
5814+
react: ">= 18.2.0"
5815+
react-native: "*"
5816+
checksum: 10/ca5afc5a4365b02c59cfb5c5c1338258d4679f9f65bf185afa36badf84cc20a07c0414a9c6fcbc34bebd94467125ccdab7ded832dbe05b1509ce84f809c7ed54
5817+
languageName: node
5818+
linkType: hard
5819+
57855820
"@react-navigation/routers@npm:^7.5.1":
57865821
version: 7.5.1
57875822
resolution: "@react-navigation/routers@npm:7.5.1"
@@ -5800,6 +5835,15 @@ __metadata:
58005835
languageName: node
58015836
linkType: hard
58025837

5838+
"@react-navigation/routers@npm:^7.6.0":
5839+
version: 7.6.0
5840+
resolution: "@react-navigation/routers@npm:7.6.0"
5841+
dependencies:
5842+
nanoid: "npm:^3.3.11"
5843+
checksum: 10/bc92608159d13c73991d2947b444da0040707f930c67712b31088e0eb9a5bf2c422afa54495066828b08100803bd24675b121c550430fee92fe6a189fea433d2
5844+
languageName: node
5845+
linkType: hard
5846+
58035847
"@react-navigation/stack@npm:^7.8.10":
58045848
version: 7.8.10
58055849
resolution: "@react-navigation/stack@npm:7.8.10"
@@ -16086,7 +16130,7 @@ __metadata:
1608616130
"@react-native/typescript-config": "npm:0.81.4"
1608716131
"@react-navigation/bottom-tabs": "npm:^7.15.9"
1608816132
"@react-navigation/devtools": "npm:^7.0.44"
16089-
"@react-navigation/native": "npm:^7.2.2"
16133+
"@react-navigation/native": "npm:^7.3.0"
1609016134
"@react-navigation/native-stack": "npm:^7.14.11"
1609116135
"@react-navigation/stack": "npm:^7.8.10"
1609216136
"@rnx-kit/metro-config": "npm:^2.1.0"
@@ -17922,6 +17966,13 @@ __metadata:
1792217966
languageName: node
1792317967
linkType: hard
1792417968

17969+
"standard-navigation@npm:^0.0.7":
17970+
version: 0.0.7
17971+
resolution: "standard-navigation@npm:0.0.7"
17972+
checksum: 10/7c04912a93cd09d3e19c8c47a52f7808b53bc1b6fb897e21261e3401cb4340d505e9e4e387ac50662aa0534cdb2d091c03aeb5efc72fcd678925a3af5bbfce74
17973+
languageName: node
17974+
linkType: hard
17975+
1792517976
"statuses@npm:2.0.1":
1792617977
version: 2.0.1
1792717978
resolution: "statuses@npm:2.0.1"

0 commit comments

Comments
 (0)