Skip to content

[Android] Build fails with Unresolved reference 'badgeBackgroundColor' in v1.0.4 #481

@joshkeldam

Description

@joshkeldam

Description

Android build fails with Kotlin compilation errors in [email protected]:

e: RCTTabView.kt:260:48 Unresolved reference 'badgeBackgroundColor'.
e: RCTTabView.kt:272:48 Unresolved reference 'badgeTextColor'.
e: RCTTabView.kt:266:48 Unresolved reference 'colorError'.

Root Cause

RCTTabView.kt (lines 260-283) accesses item.badgeBackgroundColor and item.badgeTextColor, but these properties are missing from the TabInfo data class in RCTTabViewManager.kt.

The TabInfo data class currently has:

data class TabInfo(
  val key: String,
  val title: String,
  val badge: String?,
  val activeTintColor: Int?,
  val hidden: Boolean,
  val testID: String?
)

But RCTTabView.kt expects:

  • item.badgeBackgroundColor
  • item.badgeTextColor

Additionally, com.google.android.material.R.attr.colorError is unresolved, likely due to Material library version compatibility.

Steps to Reproduce

  1. Install [email protected]
  2. Run Android build: ./gradlew assembleDebug
  3. Build fails with the above errors

Environment

  • react-native-bottom-tabs: 1.0.4
  • React Native: 0.82.1
  • Gradle: 9.0.0

Suggested Fix

  1. Add missing properties to TabInfo data class:
data class TabInfo(
  val key: String,
  val title: String,
  val badge: String?,
  val badgeBackgroundColor: Int?,
  val badgeTextColor: Int?,
  val activeTintColor: Int?,
  val hidden: Boolean,
  val testID: String?
)
  1. Populate them in setItems():
badgeBackgroundColor = if (item.hasKey("badgeBackgroundColor")) item.getInt("badgeBackgroundColor") else null,
badgeTextColor = if (item.hasKey("badgeTextColor")) item.getInt("badgeTextColor") else null,
  1. Simplify badge color application to avoid colorError resolution:
item.badgeBackgroundColor?.let { badge.backgroundColor = it }
item.badgeTextColor?.let { badge.badgeTextColor = it }

I'm happy to submit a PR with these fixes.

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