Commit 87b1bad
Summary:
Fixes #39092
Right now, the `testID` prop that is passed to the ActivityIndicator component is not being applied as a `resource-id`. In this PR, we overwrite the `onInitializeAccessibilityNodeInfo` in the `ProgressBarContainerView` to set this `resource-id`.
## Changelog:
[ANDROID][ADDED] - ActivityIndicator: setting `resource-id` from the `testID` prop
Pull Request resolved: #48271
Test Plan:
Render a simple activity indicator and pass a `testID` as follows:
```tsx
import {ActivityIndicator} from 'react-native';
function Playground() {
return (
<ActivityIndicator
color="white"
testID="default_activity_indicator"
accessibilityLabel="Wait for content to load!"
/>
);
}
```
<details>
<summary>Inspect the element using an e2e tool such as Maestro or Appium, the `resource-id` is not present: (see screenshot)</summary>
<img width="736" alt="image" src="https://github.com/user-attachments/assets/3aecce5f-3850-4c62-b1ab-aed4133e12bc" />
</details>
---
Apply the changes and then:
<details>
<summary>Inspect again, the `resource-id` is present now: (see screenshot)</summary>
<img width="731" alt="image" src="https://github.com/user-attachments/assets/5a0e3bfa-924a-4a50-8eef-2f7fff7e1290" />
</details>
Reviewed By: rshest
Differential Revision: D67274852
Pulled By: javache
fbshipit-source-id: 2ac8d2bbebed5d1723eb33e735bbf3b477a42572
1 parent 6076a41 commit 87b1bad
File tree
1 file changed
+11
-0
lines changed- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar
1 file changed
+11
-0
lines changedLines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
30 | 41 | | |
31 | 42 | | |
32 | 43 | | |
| |||
0 commit comments