react / react/react-native

Alert.alert with 2 buttons only shows 1 button on iOS 26 simulator

Đang mở
#56,805 3 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: Alert Component: Button 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

Bug: Alert.alert only shows 1 button on iOS 26 simulator when using style: 'cancel' + style: 'destructive'

React Native Version: 0.85.1
Platform: iOS 26 Simulator (iPhone 16 Pro)
OS: macOS

Description:
When calling Alert.alert with two buttons — one with style: 'cancel' and one with style: 'destructive' — only one button renders. Swapping the order or changing styles makes the other button appear, but never both at the same time.

Reproducible Code:

Alert.alert('Delete', 'Are you sure?', [
{ text: 'Cancel', style: 'cancel' },
{ text: 'Delete', style: 'destructive', onPress: () => {} },
]);
Expected: Both Cancel and Delete buttons visible side by side.

Actual: Only one button renders depending on order and style combination.

Workaround: Replace Alert.alert with a custom Modal component.

Steps to reproduce
  1. Create a React Native project (RN 0.85.1)
  2. Add a button that triggers Alert.alert with two buttons:
    • First button: { text: 'Cancel', style: 'cancel' }
    • Second button: { text: 'Delete', style: 'destructive', onPress: () => {} }
  3. Run on iOS 26 Simulator (iPhone 16 Pro)
  4. Tap the button to trigger the Alert
  5. Observe that only one button is visible in the dialog
React Native Version

0.85.1

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info
info Fetching system and libraries information...
System:
  OS: macOS 26.5
  CPU: (10) arm64 Apple M4
  Memory: 575.81 MB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 25.2.1
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 11.6.2
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2025.12.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.4
      - iOS 26.4
      - macOS 26.4
      - tvOS 26.4
      - visionOS 26.4
      - watchOS 26.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.2 AI-252.27397.103.2522.14617522
  Xcode:
    version: 26.4.1/17E202
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.17
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/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.85.1
    wanted: 0.85.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.85.3 is now available (your project is running on v0.85.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.85.3
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.85.1&to=0.85.3
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
Stacktrace or Logs
No crash or stack trace. The Alert renders silently with only one button visible.
No errors in Metro bundler or Xcode console.
MANDATORY Reproducer

https://snack.expo.dev/@mohantvj/grumpy-indigo-soylent

Screenshots and Videos

Note: This reproducer works correctly on Expo Snack (Old Architecture).
The bug only occurs with New Architecture enabled (newArchEnabled: true)
on iOS 26 simulator with RN 0.85.1.

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

Bắt đầu với reproducer Snack bắt buộc và so sánh hành vi của Alert.alert trên iOS 26 khi bật New Architecture với kết quả Old Architecture đã được báo cáo. Xác nhận rằng cả hai nút cancel và destructive đều được render trong cấu hình bị ảnh hưởng, sau đó thêm hoặc cập nhật coverage cho tổ hợp hai nút này nếu tìm thấy entry point của test liên quan.

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

Đánh giá

Công nghệ
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
45/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.