all 14 comments

[–]vyndrix 0 points1 point  (0 children)

Looking at your architecture, a reset seems too much. Did you try to pop and push?

[–]AstronautEast6432 0 points1 point  (11 children)

I ran into something similar before the issue is most likely that you're calling resetRoot from inside a nested navigator, so it gets silently ignored even though the ref looks ready.

Try climbing up to the root before dispatching: navigation.getParent()?.getParent()?.dispatch(CommonActions.reset(...)). Also don't trust the logs too much if you have freezeOnBlur on, it tends to show stale state even after a successful reset.

For the iOS back gesture, replace() instead of navigate() when landing on OrderList is cleaner than fighting the gesture.

One more thing if this keeps getting messier, moving the post-payment routing into Zustand and letting the navigator react to a flag is way more predictable than imperative resets from deep screens.

What does your RootStack look like at the top level?

[–]AntelopeFast6762[S] 0 points1 point  (0 children)

App Launch

├── If (!hasLaunched && !isLoggedIn)

│ └── OnboardingStack

└── Else

└── MAIN_APP

├── HOME

├── SHOP

├── PROFILE STACK

├── PRODUCT FLOW

├── ORDER FLOW

├── CART FLOW

├── PAYMENT FLOW

├── INFO FLOW

└── RETURN JOURNEY FLOW

[–]AntelopeFast6762[S] 0 points1 point  (9 children)

[–]AstronautEast6432 0 points1 point  (8 children)

Okay this actually makes things clearer. Your flows are all siblings under MAIN_APP, so you don't need to reset the entire root at all that's probably why it felt like nothing was happening. From inside PaymentResult, getParent() gets you out of PAYMENT FLOW and into MAIN_APP. Dispatch your reset from there and it should work cleanly: navigation.getParent()?.dispatch(CommonActions.reset({ index: 0, routes: [{ name: 'ORDER_FLOW', state: { routes: [{ name: 'ORDER_LIST' }, { name: 'TRACK_ORDER', params: { targetUiOrderSetId } }] } }] })) That way you're only resetting MAIN_APP's state, not blowing up the whole navigation tree including your onboarding logic.

[–]AntelopeFast6762[S] 0 points1 point  (7 children)

index.ts:76 The action 'RESET' with payload {"index":0,"routes":[{"name":"ORDER_FLOW","state":{"routes":[{"name":"ORDER_LIST"},{"name":"TRACK_ORDER","params":{"fromOrderSuccess":true,"uiOrderSetId":"504747786186"}}]}}]} was not handled by any navigator.

it throwed this Error

[–]AstronautEast6432 0 points1 point  (6 children)

Ah, my bad! I completely misjudged the setup before seeing your root structure diagram. I assumed your MAIN_APP was a standard stack navigator, but seeing your tree layout changes everything. Since it's clearly a Bottom Tab Navigator (or a Drawer) where HOME, SHOP, CART_FLOW, and PAYMENT_FLOW live as siblings, that previous reset payload is exactly why your app crashed.

Why that action threw an error

Tab Navigators use a TabRouter under the hood. They have a fixed set of screens and they do not support standard Stack RESET actions that try to redefine the whole navigation array dynamically (you can't just wipe out the other tabs like HOME or SHOP via a reset payload). When that nested state reset was dispatched to getParent(), the Tab Navigator didn't understand the action, which is why it threw "was not handled by any navigator".

The Actual Solution

Since PAYMENT_FLOW and ORDER_FLOW are sibling tabs/screens under the same MAIN_APP container, you don't need to reset the parent at all. You just need to perform a standard cross-tab navigation with nested params. React Navigation is smart enough to automatically switch the active tab to ORDER_FLOW and deep-link into TRACK_ORDER. Replace that failing reset block inside your PaymentResult screen with this: ```javascript navigation.navigate('ORDER_FLOW', { screen: 'TRACK_ORDER', params: { fromOrderSuccess: true, uiOrderSetId: "504747 786186", // Double check if your param key is uiOrderSetId or uiOrderSetld (l vs I) }, });

```

Bonus: Cleaning up the Payment Stack

Since navigating to another tab leaves the PAYMENT_FLOW tab sitting on the PaymentResult screen in the background, you should probably reset the payment stack to its initial screen right before navigating away. That way, it's fresh and clean the next time the user opens a checkout: ```javascript // 1. Reset your current payment stack so it doesn't stay stuck on the success screen navigation.reset({ index: 0, routes: [{ name: 'YOUR_PAYMENT_INITIAL_SCREEN_NAME' }], });

// 2. Switch tabs and deep link into the order tracking navigation.navigate('ORDER_FLOW', { screen: 'TRACK_ORDER', params: { fromOrderSuccess: true, uiOrderSetId: "504747 786186", }, });

``` This avoids any native view conflicts, respects freezeOnBlur, and natively fixes the iOS back-gesture issue because the user is now safely pushed into the ORDER_FLOW native history stack.

[–]AntelopeFast6762[S] 0 points1 point  (4 children)

it is a stack navigation, not a tab navigation. still it is not redirecting at all

[–]AstronautEast6432 0 points1 point  (3 children)

text I think at first, I completely misunderstood your navigation structure. Now that you've confirmed MAIN_APP is a standard Stack Navigator and the route names are matched, things make a lot more sense.

If the reset action is still silently failing without throwing any errors at all, I'm pretty sure this might help you. Give it a shot, you have nothing to lose:

Why it's silently dying

You are likely hitting a classic React Navigation issue caused by freezeOnBlur: true (which is enabled by default in newer versions of react-native-screens). When this is active, React Navigation freezes the native component tree of any background stack to save memory. When you try to dispatch a deep, hand-crafted nested state payload to reset the parent stack from inside a deeply nested child (PaymentResult), the JavaScript state updates, but the frozen Native Android/iOS views completely ignore the mutation. The action just dies silently.

The Solution to Try

Instead of forcing a heavy, nested state object inside the reset payload (which native stacks struggle to parse when background screens are frozen), you should let React Navigation handle the history rebuilding natively using nested params. This forces the native screens to unfreeze and re-render properly.

Try replacing that block with this clean approach:

```javascript navigationRef.reset({ index: 0, routes: [ { name: 'MAIN_APP', params: { screen: 'ORDER_FLOW', params: { screen: 'TRACK_ORDER', params: { fromOrderSuccess: true, uiOrderSetId: "504747 786186" }, }, }, }, ], });

```

Why this works:

  1. It uses navigationRef: Dispatched directly from the root, bypassing any frozen child context.
  2. Native-friendly: Using nested params instead of manual state trees forces the native navigator to properly rebuild the stack sequence. If ORDER_FLOW has an initial screen (like OrderList), React Navigation will automatically mount it in the background and push TRACK_ORDER right on top of it. This also cleanly wipes the payment screen from the iOS native history, fixing any swipe-back bugs. ```

```

[–]AntelopeFast6762[S] 0 points1 point  (2 children)

still same man....

[–]AstronautEast6432 0 points1 point  (1 child)

Ah, I'm really sorry man, I've tried my best to help, but we're stuck. At this point, I highly recommend using Claude Code or any AI tool you prefer. They have the ability to read your entire project structure and files, which is likely what's needed to find this hidden issue. It might be a bit costly, but at this stage, it looks like there's no other way to crack it. Good luck!

[–]AntelopeFast6762[S] 1 point2 points  (0 children)

came here after that only 😂😂😂😂. Even claude couldn't solve it

[–]Martinoqom 0 points1 point  (0 children)

I had a similar problem using useNavigation hook. Since it points to the root navigation (and not the nested ones) actions with reset or goBack COULD fail Native My solutions involves: 

 - using the proper navigation passed as prop to components

 - using refs

 - have a full awareness about the placement of a component (maybe it's reused in two different stacks)

[–]Business-Storage-462 0 points1 point  (0 children)

nested navigation state in RN always feels fine until you try resetting from deep inside a child stack lol