react / react/react-native

Unexpected color given in StatusBar._updatePropsStack when using PlatformColor for theming

Ouverte
#48,402 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Component: StatusBar Issue: Author Provided Repro
Langage dominant
C++
Étoiles
127k
Forks
25.3k
Merge moyen
1 j 23 h
PR mergées (30 j)
4

Description

Description

Setting a PlatformColor value as the backgroundColor prop of StatusBar causes an "Unexpected color given in StatusBar._updatePropsStack" error.

Steps to reproduce
  1. Install and run the application on an Android device or emulator which supports Material You theming with npm run android
  2. Notice the background colour was appropriately applied to the View defined in line 27
  3. Uncomment line 25 (StatusBar.backgroundColor)
  4. The app throws an "Unexpected color given in StatusBar._updatePropsStack" error
React Native Version

0.76.5

Affected Platforms

Runtime - Android

Output of npx react-native info
System:
  OS: macOS 15.1.1
  CPU: (8) arm64 Apple M1
  Memory: 121.88 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.3.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.11.25.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-24 | Google APIs ARM 64 v8a
      - android-24 | Google APIs Intel x86 Atom
      - android-24 | Google APIs Intel x86 Atom_64
      - android-29 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-S | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/marin/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false
Stacktrace or Logs
(NOBRIDGE) ERROR  Invariant Violation: Unexpected color given in StatusBar._updatePropsStack
Reproducer

https://github.com/Glavotaner/InvariantStatusBar

Screenshots and Videos

No response

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par le reproducer InvariantStatusBar lié et exécutez-le avec npm run android sur un appareil ou un émulateur Material You. Suivez StatusBar._updatePropsStack lorsque PlatformColor est transmis comme backgroundColor ; c’est terminé lorsque la couleur de la plateforme est acceptée sans l’erreur d’invariant et que l’arrière-plan de la barre d’état est appliqué.

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é
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.