Skip to content

cds-mobile's react-native-navigation-bar-color peer dep breaks Android builds on Gradle 9 #789

Description

@ZeLonewolf

@coinbase/cds-mobile declares react-native-navigation-bar-color@^2.0.2 as a peer dependency (used only by AndroidNavigationBar / useAndroidNavigationBarUpdater, which calls changeNavigationBarColor). That library's android/build.gradle still has a buildscript block calling jcenter(). jcenter was shut down in 2021, and Gradle 9 removed the jcenter() method entirely, so any app on React Native 0.82+ / Expo SDK 55+ (which ship Gradle 9) fails to build during configuration with Could not find method jcenter() on the :react-native-navigation-bar-color project.

This is latest as of 9.6.3 — the peer dep is unchanged.

The upstream library looks abandoned: last commit and last npm release were both December 2022 (2.0.2 is the newest version), with 28 open issues and several unmerged PRs, including requests to remove jcenter() open since early 2023. So waiting on an upstream release isn't realistic. I've opened a PR against it as a stopgap (thebylito/react-native-navigation-bar-color#72) that removes the dead buildscript/jcenter() block and adds the AGP 8 namespace, but there's no sign it'll be merged or published.

For now consumers have to work around it (e.g. a patch-package/pnpm patch on the dependency), which isn't great to have to do for a transitive CDS peer dep. It'd be better handled in CDS. A few options:

  • Vendor the tiny bit of functionality actually used (changeNavigationBarColor is a small native call) so there's no dependency on the abandoned package, or
  • Move to a maintained alternative (react-native-system-navigation-bar, or expo-navigation-bar / the edge-to-edge approach on newer Expo), or
  • If you want to stay on the current package, pin to a fork with the jcenter fix.

This is part of getting cds-mobile building cleanly on modern React Native, so it's related to #763 (widening the RN peer range to 0.83.x).

Repro: install @coinbase/cds-mobile in an RN 0.82+/Expo SDK 55+ app and run an Android release build (expo prebuild + Gradle assemble).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions