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

Fixes facebook/react-native#9777 Add support for resource-id #18514

Closed
wants to merge 3 commits into from
Closed

Fixes facebook/react-native#9777 Add support for resource-id #18514

wants to merge 3 commits into from

Conversation

lightboys22
Copy link

Track react tag using android.view.View.tag. Allow developers to set resource id by setting component.testID

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

This pull request fixes the following issue.
#9777

Test Plan

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)

Related PRs

This PR doesn't require a documentation change.

Release Notes

[ANDROID] [BUGFIX] [com/facebook/react/uimanager/BaseViewManager] - Allow developers to set resource id by setting component.testID

Track react tag using android.view.View.tag.  Allow developers to set resource id by setting component.testID

Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

This pull request fixes the following issue.
#9777

## Test Plan

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)

## Related PRs

This PR doesn't require a documentation change.

## Release Notes

[ANDROID] [BUGFIX] [com/facebook/react/uimanager/BaseViewManager] - Allow developers to set resource id by setting component.testID
@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@lightboys22 lightboys22 changed the title Fixes facebook/react-native#9777 Add support for resource-id Fixes facebook/react-native#9777 facebook/react-native#9942 Add support for resource-id Mar 23, 2018
@lightboys22 lightboys22 changed the title Fixes facebook/react-native#9777 facebook/react-native#9942 Add support for resource-id Fixes facebook/react-native#9777 Add support for resource-id Mar 23, 2018
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 23, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@lightboys22 lightboys22 deleted the v0_54_2_test_id_resource_id branch March 23, 2018 19:24
@grabvinod
Copy link

@lightboys22 can yo confirm which version of react native this has the support?

@lightboys22
Copy link
Author

@grabvinod Hi Vinod, I verified my changes on react native v54.
I just rebased my commit and resolved merge conflict. See the new pull request here. But I need help fixing the failing tests.

@nes123
Copy link

nes123 commented Sep 10, 2018

Can you clarify where the xml file should added to? I tried to create it in /myproject/android/app/src/main/res/values

but I cant see good results.

@lightboys22
Copy link
Author

Can you clarify where the xml file should added to? I tried to create it in /myproject/android/app/src/main/res/values

but I cant see good results.

Hi nes123, that is the correct folder. But you need to change the React Native source code in order to be able to change the Android.view.View.id

@nes123
Copy link

nes123 commented Sep 10, 2018

any plans to try to merge your changes?

@lightboys22
Copy link
Author

lightboys22 commented Sep 10, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants