react-navigation / react-navigation/react-navigation

Stack Animations Not Working as expected when re-rendering app

Open
#10,632 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug platform:ios repro provided
Dominant language
TypeScript
Stars
24.5k
Forks
5.1k
Avg merge
1d 5h
Merged PRs (30d)
18

Description

Current behavior

Hi! I'm fairly new to this and am trying to fix the appearance of the animations when going from one screen to another. Currently, if the user re-loads the app before completing onboarding (the full stack shown below), the animations for going forward or backward from a screen are reversed. I think the issue is that when the user re-renders the app, the stack is partially reset and does not keep track of the pages the user already visited. I could be incorrect but I am trying to solve this behavior and would appreciate any help. The video below shows the incorrect behavior for the three pages when I try to go back from "Hometown". Going back from "Hometown" to "Gender" has an animation that looks like we are going forward.

https://user-images.githubusercontent.com/99685335/173263411-bd817f43-f867-4ee3-83ee-c079a36877e4.mp4

Expected behavior

I want the animation to correspond correctly with the position in the stack even when the user reloads the app in the middle of onboarding. I.e. if the user reloads when on the "Hometown" screen and chooses to go back to "Gender" and then back to "Name", the animation should appear to be going backward, not forwards. The correct animation is below

https://user-images.githubusercontent.com/99685335/173263469-234a717a-c372-46c1-aacf-0af03b694780.mp4

Reproduction

Should work like this: https://snack.expo.dev/@rafatcb/react-navigation-next-and-back-animations

Platform
  • Android
  • iOS
  • Web
  • Windows
  • MacOS
Packages
  • @react-navigation/​bottom-tabs
  • @react-navigation/​drawer
  • @react-navigation/​material-bottom-tabs
  • @react-navigation/​material-top-tabs
  • @react-navigation/​stack
  • @react-navigation/​native-stack
Environment
  • [] I've removed the packages that I don't use
package version
@react-navigation/native 6.0.8
@react-navigation/bottom-tabs 6.2.0
@react-navigation/native-stack 6.5.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Expo Snack reproduction and inspect the @react-navigation/native-stack behavior during onboarding reloads. Reproduce the transition from Hometown back through Gender to Name, then verify that stack position is preserved and backward navigation consistently uses the backward animation on iOS.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.