Bluesky app fork with some witchin' additions 💫

patch react-navigation to fix history bug (#2955)

* patch react-navigation

- https://github.com/react-navigation/react-navigation/pull/11833

* add readme

authored by hailey.at and committed by

GitHub 93b5eff4 874489b4

+61
+56
patches/@react-navigation+native+6.1.7.patch
··· 1 + diff --git a/node_modules/@react-navigation/native/lib/commonjs/useLinking.js b/node_modules/@react-navigation/native/lib/commonjs/useLinking.js 2 + index ef4f368..2b0da35 100644 3 + --- a/node_modules/@react-navigation/native/lib/commonjs/useLinking.js 4 + +++ b/node_modules/@react-navigation/native/lib/commonjs/useLinking.js 5 + @@ -273,8 +273,12 @@ function useLinking(ref, _ref) { 6 + }); 7 + const currentIndex = history.index; 8 + try { 9 + - if (nextIndex !== -1 && nextIndex < currentIndex) { 10 + - // An existing entry for this path exists and it's less than current index, go back to that 11 + + if ( 12 + + nextIndex !== -1 && 13 + + nextIndex < currentIndex && 14 + + // We should only go back if the entry exists and it's less than current index 15 + + history.get(nextIndex - currentIndex) 16 + + ) { // An existing entry for this path exists and it's less than current index, go back to that 17 + await history.go(nextIndex - currentIndex); 18 + } else { 19 + // We couldn't find an existing entry to go back to, so we'll go back by the delta 20 + diff --git a/node_modules/@react-navigation/native/lib/module/useLinking.js b/node_modules/@react-navigation/native/lib/module/useLinking.js 21 + index 62a3b43..11a5a28 100644 22 + --- a/node_modules/@react-navigation/native/lib/module/useLinking.js 23 + +++ b/node_modules/@react-navigation/native/lib/module/useLinking.js 24 + @@ -264,8 +264,12 @@ export default function useLinking(ref, _ref) { 25 + }); 26 + const currentIndex = history.index; 27 + try { 28 + - if (nextIndex !== -1 && nextIndex < currentIndex) { 29 + - // An existing entry for this path exists and it's less than current index, go back to that 30 + + if ( 31 + + nextIndex !== -1 && 32 + + nextIndex < currentIndex && 33 + + // We should only go back if the entry exists and it's less than current index 34 + + history.get(nextIndex - currentIndex) 35 + + ) { // An existing entry for this path exists and it's less than current index, go back to that 36 + await history.go(nextIndex - currentIndex); 37 + } else { 38 + // We couldn't find an existing entry to go back to, so we'll go back by the delta 39 + diff --git a/node_modules/@react-navigation/native/src/useLinking.tsx b/node_modules/@react-navigation/native/src/useLinking.tsx 40 + index 3db40b7..9ba4ecd 100644 41 + --- a/node_modules/@react-navigation/native/src/useLinking.tsx 42 + +++ b/node_modules/@react-navigation/native/src/useLinking.tsx 43 + @@ -381,7 +381,12 @@ export default function useLinking( 44 + const currentIndex = history.index; 45 + 46 + try { 47 + - if (nextIndex !== -1 && nextIndex < currentIndex) { 48 + + if ( 49 + + nextIndex !== -1 && 50 + + nextIndex < currentIndex && 51 + + // We should only go back if the entry exists and it's less than current index 52 + + history.get(nextIndex - currentIndex) 53 + + ) { 54 + // An existing entry for this path exists and it's less than current index, go back to that 55 + await history.go(nextIndex - currentIndex); 56 + } else {
+5
patches/@react-navigation+native+6.1.7.patch.md
··· 1 + # React Navigation history bug patch 2 + 3 + This patches react-navigation to fix the issues in https://github.com/bluesky-social/social-app/issues/710. 4 + 5 + This is based on the PR found at https://github.com/react-navigation/react-navigation/pull/11833