react / react/react-native

[iOS] Animated Bug: Animations do not run correctly in React Navigation

Đang mở
#56,347 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

API: Animated Needs: Triage :mag: Platform: iOS
Ngôn ngữ chính
C++
Star
127k
Fork
25.3k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Description

Hello!

I'm having some issues using the React Navigation library with the bottom tabs. I created a bottom tabs navigator, and I noticed that sometimes when I change the tab, the previous tab disappears and the focused tab doesn't show. This issue appears only when using animations for the tab switching. You can see in the reproduction example that I used "shift" animation.
I debugged the library "@react-navigation/bottom-tabs", and everything seems to be just fine, and I think the issue is in React Native, in the Animated API. The bottom tabs library animates an Animated.Value between -1 and 1, and then passes an interpolated value to the Screen. This interpolation seems to be broken.
I used version "7.15.9" of "@react-navigation/bottom-tabs".
You can find the code I'm talking about here: https://github.com/react-navigation/react-navigation/blob/f2ca954afa5a478de49489199444d7a5269df261/packages/bottom-tabs/src/views/BottomTabView.tsx#L296

Steps to reproduce
  1. Clone the reproducer app
  2. Install dependencies using "yarn"
  3. Start dev server
  4. Run the app from Xcode
  5. Swipe between the two tabs slow and fast many times, until you see the second tab won't render anything
React Native Version

0.84.1

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
System:
  OS: macOS 26.3.1
  CPU: (14) arm64 Apple M3 Max
  Memory: 4.64 GB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.13.1
    path: /Users/george/.nvm/versions/node/v22.13.1/bin/node
  Yarn:
    version: 3.6.4
    path: /Users/george/.nvm/versions/node/v22.13.1/bin/yarn
  npm:
    version: 10.9.2
    path: /Users/george/.nvm/versions/node/v22.13.1/bin/npm
  Watchman:
    version: 2025.05.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/george/.rvm/gems/ruby-3.0.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.0
      - iOS 26.0
      - macOS 26.0
      - tvOS 26.0
      - visionOS 26.0
      - watchOS 26.0
  Android SDK:
    API Levels:
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
      - "36"
      - "36"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 34.0.0
      - 35.0.0
      - 36.0.0
      - 36.0.0
    System Images:
      - android-34 | Android TV ARM 64 v8a
      - android-35 | ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-35 | Google Play Tablet ARM 64 v8a
      - android-36 | Google Play ARM 64 v8a
      - android-36 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.30387.90.2532.14935130
  Xcode:
    version: 26.0.1/17A400
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.0.0
    path: /Users/george/.rvm/rubies/ruby-3.0.0/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.0
    wanted: 20.1.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.84.1
    wanted: 0.84.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
No logs needed.
MANDATORY Reproducer

https://github.com/gmanole01/react-native-animated-issue

Screenshots and Videos

https://github.com/user-attachments/assets/e7ce45e9-1455-4f1f-853f-6c7c18a49245

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Chạy trình tái hiện bắt buộc bằng yarn và Xcode, sau đó tái hiện lỗi bằng cách vuốt chậm và nhanh giữa hai tab của nó. Kiểm tra packages/bottom-tabs/src/views/BottomTabView.tsx xung quanh mã animation được liên kết và phép nội suy React Native Animated liên quan. Được xem là hoàn tất khi tab trước đây bị trống không còn xuất hiện trong các lần chuyển đổi có animation lặp lại trên iOS.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, react-native
Lĩnh vực
mobile
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.