Skip to content

Commit

Permalink
React Navigation V5 update (#2509)
Browse files Browse the repository at this point in the history
### Description

Updates react-navigation and all related dependencies to highest v5 versions.

### Other changes

N/A

### Tested

Tested on iOS simulators and Android Emulators

### How others should test

Run the wallet on iOS and Android looking for issues related to navigation or animation. 

### Related issues

N/A

### Backwards compatibility

Yes
  • Loading branch information
MuckT authored May 27, 2022
1 parent 9e0e58d commit fba69c8
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 112 deletions.
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ PODS:
- React-Core
- react-native-randombytes (3.6.0):
- React-Core
- react-native-safe-area-context (3.2.0):
- react-native-safe-area-context (3.4.1):
- React-Core
- react-native-shake (3.5.0):
- React-Core
Expand Down Expand Up @@ -655,7 +655,7 @@ PODS:
- React-RCTText
- ReactCommon/turbomodule/core
- Yoga
- RNScreens (3.10.1):
- RNScreens (3.13.1):
- React-Core
- React-RCTImage
- RNSecureRandom (1.0.0):
Expand Down Expand Up @@ -1108,7 +1108,7 @@ SPEC CHECKSUMS:
react-native-netinfo: f3f52e6d92372003b78d5cafa3557797c7beee47
react-native-plaid-link-sdk: 33cb904b956dc3b56799ac3027de8aa6fbb4b0ab
react-native-randombytes: b6677f7d495c27e9ee0dbd77ebc97b3c59173729
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
react-native-safe-area-context: 9e40fb181dac02619414ba1294d6c2a807056ab9
react-native-shake: 41a1ea8ec541fccf3f01566edef8d3cb722b00e3
react-native-simple-toast: bf002828cf816775a6809f7a9ec3907509bce11f
react-native-sms: 9e317eb8712d2f73a0da36953f15239fa535b0c0
Expand Down Expand Up @@ -1153,7 +1153,7 @@ SPEC CHECKSUMS:
RNPermissions: 034db8a73d562766f990c89abbdeaa5d6e204c67
RNPersonaInquiry: e8d8f3fe4807f6a826ff96e7fb64f482ef6c4e97
RNReanimated: ee33ab40fa252332a36aeed9d936801ed9700b24
RNScreens: 522705f2e5c9d27efb17f24aceb2bf8335bc7b8e
RNScreens: 40a2cb40a02a609938137a1e0acfbf8fc9eebf19
RNSecureRandom: b0b479d7b934a3e6deea9cb986a9c40cb5f1b360
RNSentry: fe878ca3982d7871e502ccbb90072fe764c8d07d
RNShare: d76b8c9c6e6ffb38fc18f40b4338c9d867592ed3
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@
"@react-native-firebase/remote-config": "11.5.0",
"@react-native-firebase/storage": "11.5.0",
"@react-native-masked-view/masked-view": "^0.2.6",
"@react-navigation/compat": "^5.3.10",
"@react-navigation/drawer": "^5.11.4",
"@react-navigation/material-top-tabs": "^5.3.10",
"@react-navigation/native": "^5.8.10",
"@react-navigation/stack": "^5.12.8",
"@react-navigation/compat": "^5.3.20",
"@react-navigation/core": "^6.2.1",
"@react-navigation/drawer": "^5.12.9",
"@react-navigation/material-top-tabs": "^5.3.19",
"@react-navigation/native": "^5.9.8",
"@react-navigation/stack": "^5.14.9",
"@reduxjs/toolkit": "^1.6.2",
"@segment/analytics-react-native": "^1.5.0",
"@segment/analytics-react-native-adjust": "^1.5.0",
Expand Down Expand Up @@ -170,8 +171,8 @@
"react-native-randombytes": "^3.6.0",
"react-native-reanimated": "^2.5.0",
"react-native-restart-android": "^0.0.7",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.10.1",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.13.1",
"react-native-securerandom": "^1.0.0",
"react-native-send-intent": "git+https://github.com/celo-org/react-native-send-intent#a0f4b00",
"react-native-shake": "~3.5.0",
Expand All @@ -181,7 +182,7 @@
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^12.3.0",
"react-native-swiper": "^1.6.0",
"react-native-tab-view": "^2.15.2",
"react-native-tab-view": "^2.16.0",
"react-native-tcp": "https://github.com/celo-org/react-native-tcp#44502be",
"react-native-udp": "git+https://github.com/celo-org/react-native-udp#7cbf51f",
"react-native-url-polyfill": "^1.2.0",
Expand Down
36 changes: 0 additions & 36 deletions patches/react-native-tab-view+2.15.2.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/exchange/WithdrawCeloReviewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ WithdrawCeloReviewScreen.navigationOptions = ({
const onEdit = () => {
ValoraAnalytics.track(CeloExchangeEvents.celo_withdraw_edit)
const canGoBack = navigation
.dangerouslyGetState()
.getState()
.routes.some((screen) => screen.name === Screens.WithdrawCeloScreen)
if (canGoBack) {
navigateBack()
Expand Down
2 changes: 1 addition & 1 deletion src/navigator/DrawerNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function CustomDrawerItemList({
})
}
const onPress = () => {
const activeRouteName = getActiveRouteName(navigation.dangerouslyGetState())
const activeRouteName = getActiveRouteName(navigation.getState())
if (protectedRoutes.includes(route.name) && activeRouteName !== route.name) {
// Route should be protected by PIN code
ensurePincode()
Expand Down
19 changes: 5 additions & 14 deletions src/navigator/NavigationService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// (https://github.com/react-navigation/react-navigation/issues/1439)

import { NavigationActions, StackActions } from '@react-navigation/compat'
import { CommonActions, NavigationContainerRef, NavigationState } from '@react-navigation/native'
import { NavigationActions } from '@react-navigation/compat'
import { CommonActions, StackActions } from '@react-navigation/core'
import { NavigationContainerRef, NavigationState } from '@react-navigation/native'
import { createRef, MutableRefObject } from 'react'
import sleep from 'sleep-promise'
import { PincodeType } from 'src/account/reducer'
Expand Down Expand Up @@ -49,12 +50,7 @@ export const replace: SafeNavigate = (...args) => {
ensureNavigator()
.then(() => {
Logger.debug(`${TAG}@replace`, `Dispatch ${routeName}`)
navigationRef.current?.dispatch(
StackActions.replace({
routeName,
params,
})
)
navigationRef.current?.dispatch(StackActions.replace(routeName, params))
})
.catch((reason) => {
Logger.error(`${TAG}@replace`, 'Navigation failure', reason)
Expand All @@ -67,12 +63,7 @@ export const pushToStack: SafeNavigate = (...args) => {
ensureNavigator()
.then(() => {
Logger.debug(`${TAG}@pushToStack`, `Dispatch ${routeName}`)
navigationRef.current?.dispatch(
StackActions.push({
routeName,
params,
})
)
navigationRef.current?.dispatch(StackActions.push(routeName, params))
})
.catch((reason) => {
Logger.error(`${TAG}@pushToStack`, 'Navigation failure', reason)
Expand Down
2 changes: 1 addition & 1 deletion src/qrcode/QRTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function QRTabBar({ state, descriptors, navigation, position, qrS
})

const onPressClose = () => {
navigation.dangerouslyGetParent()?.goBack()
navigation.getParent()?.goBack()
}

const onPressShare = () => {
Expand Down
124 changes: 77 additions & 47 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4353,57 +4353,75 @@
resolved "https://registry.yarnpkg.com/@react-native/polyfills/-/polyfills-2.0.0.tgz#4c40b74655c83982c8cf47530ee7dc13d957b6aa"
integrity sha512-K0aGNn1TjalKj+65D7ycc1//H9roAQ51GJVk5ZJQFb2teECGmzd86bYDC0aYdbRf7gtovescq4Zt6FR0tgXiHQ==

"@react-navigation/compat@^5.3.10":
version "5.3.10"
resolved "https://registry.yarnpkg.com/@react-navigation/compat/-/compat-5.3.10.tgz#902154241c24cf3f8dd2e4e9be287836098014bd"
integrity sha512-SbbWtkgUZGXEaENnEb/C9+QZX9ACqnWw5OPwMexkm0Y0xwnwBdF2kc1AvdwsEXU91MLVeeuBcc1gsC7e0fiNnQ==
"@react-navigation/compat@^5.3.20":
version "5.3.20"
resolved "https://registry.yarnpkg.com/@react-navigation/compat/-/compat-5.3.20.tgz#96cc6995f4bd40f70958b420735a189a87b22a0e"
integrity sha512-4CDw3QRN2zKj2L1Fxjq6ZOK95EW8UOnW3Par1o+P07qc+dZTAL1poKeRx74yqGLQyGVawozTHOgyE8/XWjdDvg==

"@react-navigation/core@^5.14.4":
version "5.14.4"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.14.4.tgz#f63a2cd214bddbd25e1181f9335c32dfc3b6460f"
integrity sha512-MzZU9PO1a/6f9KdN04dC/E4BNl6M1Ba0Tb4sQdl/32y0hM2ToxlrKcERnTLWGFIbQV+9ZV1GTrp3mlGS6U9Jpw==
"@react-navigation/core@^5.16.1":
version "5.16.1"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-5.16.1.tgz#e0d308bd9bbd930114ce55c4151806b6d7907f69"
integrity sha512-3AToC7vPNeSNcHFLd1h71L6u34hfXoRAS1CxF9Fc4uC8uOrVqcNvphpeFbE0O9Bw6Zpl0BnMFl7E5gaL3KGzNA==
dependencies:
"@react-navigation/routers" "^5.6.2"
"@react-navigation/routers" "^5.7.4"
escape-string-regexp "^4.0.0"
nanoid "^3.1.15"
query-string "^6.13.6"
react-is "^16.13.0"

"@react-navigation/drawer@^5.11.4":
version "5.11.4"
resolved "https://registry.yarnpkg.com/@react-navigation/drawer/-/drawer-5.11.4.tgz#8cc4c6ccd2579e78ee1d84948e2eedb2aff9d891"
integrity sha512-6Wpv2Ng9+ZMcmZ8AhwAvV+QvWERPlPUr2IH9ogufGu/fc/ppURStdJcMhHZPH4oOc1OcPow87Ew4oaMmjX4Pvw==
"@react-navigation/core@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-6.2.1.tgz#90459f9afd25b71a9471b0706ebea2cdd2534fc4"
integrity sha512-3mjS6ujwGnPA/BC11DN9c2c42gFld6B6dQBgDedxP2djceXESpY2kVTTwISDHuqFnF7WjvRjsrDu3cKBX+JosA==
dependencies:
"@react-navigation/routers" "^6.1.0"
escape-string-regexp "^4.0.0"
nanoid "^3.1.23"
query-string "^7.0.0"
react-is "^16.13.0"

"@react-navigation/drawer@^5.12.9":
version "5.12.9"
resolved "https://registry.yarnpkg.com/@react-navigation/drawer/-/drawer-5.12.9.tgz#b07d7391a6fea4ce07cd7a7421fdbaea37cdbb46"
integrity sha512-SYb2BCEAn+BiEwC6WBfCzs1VlWD+ZdQbxmsim6vo1o+ndPW2e+kiq7FXKRs0vUXhQRZVl2oOB3vBn0c3YCllQg==
dependencies:
color "^3.1.3"
react-native-iphone-x-helper "^1.3.0"

"@react-navigation/material-top-tabs@^5.3.10":
version "5.3.10"
resolved "https://registry.yarnpkg.com/@react-navigation/material-top-tabs/-/material-top-tabs-5.3.10.tgz#158b694e87bff2eb9577e8142415de8ac3547412"
integrity sha512-mmQYEBhcLp1DwvuD8+HiFtYPk5zP43272C/38iX2T8AblcwRdoJejuO/GUzQcEPrmZHjeAnA5GDaMiXQM4EXLQ==
"@react-navigation/material-top-tabs@^5.3.19":
version "5.3.19"
resolved "https://registry.yarnpkg.com/@react-navigation/material-top-tabs/-/material-top-tabs-5.3.19.tgz#64f3a933f5d7e86e99f3d57d9f0c1e833ffa7e4f"
integrity sha512-I7bEF99THxxcY7kCUZ5pPmwXr6kgo6L2sg3P1YJo+CcBWSGvGiHyNbZXNs15HuKRuFvEuueChNV9n8QuKBWbDA==
dependencies:
color "^3.1.3"

"@react-navigation/native@^5.8.10":
version "5.8.10"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.8.10.tgz#3fe806abff9efb085bcf595212803dd05a1347ca"
integrity sha512-OUgD1o+y7PwmhRIRqQxN0SQvVU/SHic/ek/qMvBZX8nu5/WlBNxmNRMHVxONgHlG3AQZh27NUs9ynntL7ek1zQ==
"@react-navigation/native@^5.9.8":
version "5.9.8"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-5.9.8.tgz#ac76ee6390ea7ce807486ca5c38d903e23433a97"
integrity sha512-DNbcDHXQPSFDLn51kkVVJjT3V7jJy2GztNYZe/2bEg29mi5QEcHHcpifjMCtyFKntAOWzKlG88UicIQ17UEghg==
dependencies:
"@react-navigation/core" "^5.14.4"
"@react-navigation/core" "^5.16.1"
escape-string-regexp "^4.0.0"
nanoid "^3.1.15"

"@react-navigation/routers@^5.6.2":
version "5.6.2"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.6.2.tgz#accc008c3b777f74d998e16cb2ea8e4c1fe8d9aa"
integrity sha512-XBcDKXS5s4MaHFufN44LtbXqFDH/nUHfHjbwG85fP3k772oRyPRgbnUb2mbw5MFGqORla9T7uymR6Gh6uwIwVw==
"@react-navigation/routers@^5.7.4":
version "5.7.4"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-5.7.4.tgz#8b5460e841a0c64f6c9a5fbc2a1eb832432d4fb0"
integrity sha512-0N202XAqsU/FlE53Nmh6GHyMtGm7g6TeC93mrFAFJOqGRKznT0/ail+cYlU6tNcPA9AHzZu1Modw1eoDINSliQ==
dependencies:
nanoid "^3.1.15"

"@react-navigation/stack@^5.12.8":
version "5.12.8"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.12.8.tgz#31e54e05d8a3ffaaa3e39a1a9b7969f8316a35bf"
integrity sha512-wUJFbU0v606RBXOUxHToCXJNmiwxtFYhN2TFvjxCZ3PJU+OWWx8HTmn99pT3rVH4Ax2cfO5BDUy9v+r74ZrIWw==
"@react-navigation/routers@^6.1.0":
version "6.1.0"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-6.1.0.tgz#d5682be88f1eb7809527c48f9cd3dedf4f344e40"
integrity sha512-8xJL+djIzpFdRW/sGlKojQ06fWgFk1c5jER9501HYJ12LF5DIJFr/tqBI2TJ6bk+y+QFu0nbNyeRC80OjRlmkA==
dependencies:
nanoid "^3.1.23"

"@react-navigation/stack@^5.14.9":
version "5.14.9"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.14.9.tgz#49c7b9316e6fb456e9766c901e0d607862f0ea7d"
integrity sha512-DuvrT9P+Tz8ezZLQYxORZqOGqO+vEufaxlW1hSLw1knLD4jNxkz8TJDXtfKwaz//9gb43UhTNccNM02vm7iPqQ==
dependencies:
color "^3.1.3"
react-native-iphone-x-helper "^1.3.0"
Expand Down Expand Up @@ -10082,6 +10100,11 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"

filter-obj@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b"
integrity sha1-mzERErxsYSehbgFsbF1/GeCAXFs=

finalhandler@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.0.tgz#ce0b6855b45853e791b2fcc680046d88253dd7f5"
Expand Down Expand Up @@ -14319,6 +14342,11 @@ nanoid@^3.1.15:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.16.tgz#b21f0a7d031196faf75314d7c65d36352beeef64"
integrity sha512-+AK8MN0WHji40lj8AEuwLOvLSbWYApQpre/aFJZD71r43wVRLrOYS4FmJOPQYon1TqB462RzrrxlfA74XRES8w==

nanoid@^3.1.23:
version "3.3.4"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==

nanomatch@^1.2.9:
version "1.2.9"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2"
Expand Down Expand Up @@ -15826,6 +15854,16 @@ query-string@^6.13.6:
split-on-first "^1.0.0"
strict-uri-encode "^2.0.0"

query-string@^7.0.0:
version "7.1.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-7.1.1.tgz#754620669db978625a90f635f12617c271a088e1"
integrity sha512-MplouLRDHBZSG9z7fpuAAcI7aAYjDLhtsiVZsevsfaHWDS2IDdORKbSd1kWUA+V4zyva/HZoSfpwnYMMQDhb0w==
dependencies:
decode-uri-component "^0.2.0"
filter-obj "^1.1.0"
split-on-first "^1.0.0"
strict-uri-encode "^2.0.0"

querystring-es3@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
Expand Down Expand Up @@ -16235,10 +16273,10 @@ react-native-restart-android@^0.0.7:
resolved "https://registry.yarnpkg.com/react-native-restart-android/-/react-native-restart-android-0.0.7.tgz#60bc42530ad8e54c4bfb14d462ba0c779229368d"
integrity sha512-FxTVAgYDeS+R/PSA8vdwOg0HR5NaLo/FQTOqq0kB+KGKR3APty5Qmcz0xXGBn+Ju09ueyklsRGzPR9YmcewZgg==

react-native-safe-area-context@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.2.0.tgz#06113c6b208f982d68ab5c3cebd199ca93db6941"
integrity sha512-k2Nty4PwSnrg9HwrYeeE+EYqViYJoOFwEy9LxL5RIRfoqxAq/uQXNGwpUg2/u4gnKpBbEPa9eRh15KKMe/VHkA==
react-native-safe-area-context@^3.3.2:
version "3.4.1"
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.4.1.tgz#c967a52903d55fe010b2428e5368b42f1debc0a7"
integrity sha512-xfpVd0CiZR7oBhuwJ2HcZMehg5bjha1Ohu1XHpcT+9ykula0TgovH2BNU0R5Krzf/jBR1LMjR6VabxdlUjqxcA==

react-native-safe-modules@^1.0.3:
version "1.0.3"
Expand All @@ -16247,15 +16285,7 @@ react-native-safe-modules@^1.0.3:
dependencies:
dedent "^0.6.0"

react-native-screens@^3.10.1:
version "3.10.1"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.10.1.tgz#2634a1a17380c559a06de391e4969ae72c4365ff"
integrity sha512-ZF/XHnRsuinvDY1XiCWLXxoUoSf+NgsAes2SZfX9rFQQcv128zmh/+19SSavGrSf6rQNzqytEMdRGI6yr4Gbjw==
dependencies:
react-freeze "^1.0.0"
warn-once "^0.1.0"

react-native-screens@^3.11.1:
react-native-screens@^3.11.1, react-native-screens@^3.13.1:
version "3.13.1"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.13.1.tgz#b3b1c5788dca25a71668909f66d87fb35c5c5241"
integrity sha512-xcrnuUs0qUrGpc2gOTDY4VgHHADQwp80mwR1prU/Q0JqbZN5W3koLhuOsT6FkSRKjR5t40l+4LcjhHdpqRB2HA==
Expand Down Expand Up @@ -16321,10 +16351,10 @@ react-native-swiper@^1.6.0:
dependencies:
prop-types "^15.5.10"

react-native-tab-view@^2.15.2:
version "2.15.2"
resolved "https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-2.15.2.tgz#4bc7832d33a119306614efee667509672a7ee64e"
integrity sha512-2hxLkBnZtEKFDyfvNO5EUywhy3f/EiLOBO8SWqKj4BMBTO0QwnybaPE5MVF00Fhz+VA4+h/iI40Dkrrtq70dGg==
react-native-tab-view@^2.16.0:
version "2.16.0"
resolved "https://registry.yarnpkg.com/react-native-tab-view/-/react-native-tab-view-2.16.0.tgz#cae72c7084394bd328fac5fefb86cd966df37a86"
integrity sha512-ac2DmT7+l13wzIFqtbfXn4wwfgtPoKzWjjZyrK1t+T8sdemuUvD4zIt+UImg03fu3s3VD8Wh/fBrIdcqQyZJWg==

"react-native-tcp@https://github.com/celo-org/react-native-tcp#44502be":
version "3.3.0"
Expand Down

0 comments on commit fba69c8

Please sign in to comment.