react / react/react-native

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

オープン
#53,627 コメント 11 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

API: Alert Needs: Attention Needs: Repro Platform: Android
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

必須の Snack reproducer から始め、Alert.alert の Android 実装を調査します。タイトルが空の場合、メッセージが空の場合、両方の値が空の場合の動作を確認し、その後、余分なスペースの原因となっているダイアログレイアウトを追跡します。3 つすべてのケースが意図しない空白なしでレンダリングされ、その動作が回帰テストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。