useWindowDimensions + translucent system ui returns incorrect dimensions on android
Personne n'a encore pris cette issue.
- Langage dominant
- C++
- Étoiles
- 127k
- Forks
- 25.3k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 4
Description
Description
The window height doesn't include the navigation bar height when it's displayed as "translucent". This also occurs if you enable edge-to-edge mode, which similarly shows the app UI under the system UI.
Steps to reproduce
Install and run the reproducer project
React Native Version
0.73.0
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 13.6
CPU: (8) arm64 Apple M1 Pro
Memory: 86.08 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.17.1
path: ~/.nvm/versions/node/v18.17.1/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v18.17.1/bin/yarn
npm:
version: 9.6.7
path: ~/.nvm/versions/node/v18.17.1/bin/npm
Watchman:
version: 2023.09.04.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.11.3
path: /Users/joeporpeglia/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.10121639
Xcode:
version: 15.0/15A240d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.17
path: /Users/joeporpeglia/.sdkman/candidates/java/current/bin/javac
Ruby:
version: 2.7.5
path: /Users/joeporpeglia/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.0
wanted: 0.73.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
n/a
Reproducer
https://github.com/joeporpeglia/rn-android-window-dimensions-reproducer
Screenshots and Videos
In the screenshots below the height of the blue view is set to useWindowDimensions().height.
Navigation bar height is excluded on all android devices I tested
Status bar height is excluded on Pixel 5 device
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par exécuter le rn-android-window-dimensions-reproducer associé et examinez comment useWindowDimensions rapporte la hauteur lorsque l’interface système Android est translucide ou edge-to-edge. Suivez la gestion des dimensions de la fenêtre Android depuis le hook jusqu’aux métriques natives de la fenêtre ; le travail est terminé lorsque les dimensions rapportées incluent la barre de navigation ainsi que les cas concernés de la barre d’état sur Android.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, react-native
- Domaine
- mobile
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 45/100