Commit f0f046f
Shinping Bai
Fixes #9777 Add support for resource-id
Track react tag using android.view.View.tag. Allow developers to set resource id by setting component.testID
This pull request fixes the following issue.
#9777
First, you need to declare the resource id by creating /_your_android_studio_folder_/res/values/ids.xml
```
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="my_test_id"/>
</resources>
```
Second, set the testID of your component to a resource name.
```
<Button
onPress={onButtonPress}
title="Press Me"
testID='test_id'
/>
```
Third, run the app and observe the resource id using UIAutomator viewer (/Android/sdk/tools/bin/uiautomatorviewer)
This PR doesn't require a documentation change.
[ANDROID] [BUGFIX] [com/facebook/react/uimanager/BaseViewManager] - Allow developers to set resource id by setting component.testID1 parent 1ae19f5 commit f0f046f
4 files changed
Lines changed: 4 additions & 0 deletions
File tree
- ReactAndroid/src
- androidTest/java/com/facebook/react/testing
- main/java/com/facebook/react/views
- scroll
- slider
- switchview
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
0 commit comments