react / react/react-native

[Android] Empty title / message in Alert.alert causes extra spacing

Đang mở
#53,627 11 bình luận 2 reaction 0 người được giao Xem trên GitHub

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

API: Alert Needs: Attention Needs: Repro Platform: Android
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

On Android, passing an empty string ("") for either the title or the message in Alert.alert results in visible empty space being rendered in the dialog.

Steps to reproduce

Case 1: Empty title

Alert.alert("", "Message", [
  { text: "OK", onPress: () => {} },
]);

Case 2: Empty message

Alert.alert("Warning", "", [
  { text: "OK", onPress: () => {} },
]);

Case 3: Both empty

Alert.alert("", "", [
  { text: "OK", onPress: () => {} },
]);
React Native Version

0.80.2

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info
System:
  OS: macOS 15.6.1
  CPU: (8) arm64 Apple M3
  Memory: 125.22 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.15.0
    path: ~/.nvm/versions/node/v20.15.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v20.15.0/bin/npm
  Watchman:
    version: 2024.11.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/meetkapadiya/.rvm/gems/ruby-2.7.4/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2512.13991807
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 2.7.4
    path: /Users/meetkapadiya/.rvm/rubies/ruby-2.7.4/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 19.1.1
    wanted: 19.1.1
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.80.2
    wanted: 0.80.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
MANDATORY Reproducer

https://snack.expo.dev/@meetkapadiya/alert-demo?platform=android

Screenshots and Videos
Image

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 Snack reproducer bắt buộc và kiểm tra phần triển khai Android của Alert.alert. Xác minh hành vi đối với tiêu đề trống, thông báo trống và khi cả hai giá trị đều trống, sau đó lần theo bố cục hộp thoại chịu trách nhiệm cho khoảng cách thừa. Hoàn thành khi cả ba trường hợp đều được render mà không có khoảng trống ngoài ý muốn và hành vi này được kiểm thử hồi quy.

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

Đánh giá

Công nghệ
android, 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
52/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.