Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] ActivityIndicator: setting resource-id from the testID prop #48271

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ package com.facebook.react.views.progressbar
import android.content.Context
import android.graphics.PorterDuff
import android.view.ViewGroup
import android.view.accessibility.AccessibilityNodeInfo
import android.widget.FrameLayout
import android.widget.ProgressBar
import com.facebook.react.R
import com.facebook.react.bridge.JSApplicationIllegalArgumentException

/**
Expand All @@ -27,6 +29,15 @@ internal class ProgressBarContainerView(context: Context) : FrameLayout(context)

private var progressBar: ProgressBar? = null

override fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(info)

val testId = getTag(R.id.react_test_id) as String?
if (testId != null) {
info.viewIdResourceName = testId
}
}

internal fun apply() {
this.progressBar?.let { progressBar ->
progressBar.isIndeterminate = indeterminate
Expand Down
Loading