100% height does not match window height on some devices.
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 height obtained from useWindowDimensions() and the height provided by "onLayout" when the style is "height: 100%" is not consistent on some Android devices. I have specifically seen this on the Nexus 4 and Nexus 5X devices. When the same code runs on the Pixel 6, it provide consistent results out to many decimal places.
Steps to reproduce
- Clone this project: HeightBug (github) (based on the standard new tempate-- only App.tsx differs)
- Run it on a Pixel 6 (emulator, API 33). See that it reports similar numbers
- Run it on a Nexus 4 (emulator, API 33). See that it does dissimilar numbers (616, and 592 for me).
React Native Version
0.73.1
Affected Platforms
Runtime - Android
Output of npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 14.2
CPU: (10) arm64 Apple M1 Max
Memory: 79.38 MB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.16.1
path: ~/.nvm/versions/node/v18.16.1/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v18.16.1/bin/yarn
npm:
version: 9.5.1
path: ~/.nvm/versions/node/v18.16.1/bin/npm
Watchman:
version: 2023.07.03.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.0
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK:
API Levels:
- "29"
- "33"
- "34"
Build Tools:
- 29.0.2
- 30.0.3
- 33.0.0
- 34.0.0
System Images:
- android-21 | Google APIs ARM 64 v8a
- android-23 | ARM 64 v8a
- android-33 | Google APIs ARM 64 v8a
- android-33 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: Not Found
Xcode:
version: 15.0.1/15A507
path: /usr/bin/xcodebuild
Languages:
Java:
version: 20.0.1
path: /Users/dcorbin/.jenv/shims/javac
Ruby:
version: 3.1.0
path: /Users/dcorbin/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.1
wanted: 0.73.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
There is no crash.
Reproducer
https://github.com/dcorbin/rnHeightBug
Screenshots and Videos
Nexus4Api33
Pixel6API33
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 avec le reproducteur rnHeightBug et comparez useWindowDimensions() au résultat de onLayout pour une vue stylée avec height: 100% sur les configurations Pixel 6 et Nexus 4 API 33. Examinez le comportement de mise en page Android de React Native 0.73.1 impliqué dans ces mesures. Le travail est terminé lorsque les hauteurs rapportées sont cohérentes sur les appareils concernés sans modifier la mise en page prévue du reproducteur.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, react-native
- Domaine
- mobile-dev
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100