mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use tag ids for testID
Summary: View tags are currently used for end-to-end test IDs. We'd like to overload the tag field with other information such as nativeID (for native refs) and transitionID (for shared element transitions) in the future. Added a key for testID's tag Reviewed By: AaaChiuuu Differential Revision: D4833045 fbshipit-source-id: c2f9371c9a3dbb2411e114f4f096f723ac3132c0
This commit is contained in:
committed by
Facebook Github Bot
parent
da43c297f4
commit
3bf367cbb7
@@ -26,5 +26,6 @@ android_library(
|
||||
react_native_target("java/com/facebook/react/modules/i18nmanager:i18nmanager"),
|
||||
react_native_target("java/com/facebook/react/touch:touch"),
|
||||
react_native_target("java/com/facebook/react/uimanager/annotations:annotations"),
|
||||
react_native_target("res:uimanager"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.facebook.react.uimanager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import com.facebook.react.R;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
|
||||
@@ -85,6 +86,9 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
|
||||
@ReactProp(name = PROP_TEST_ID)
|
||||
public void setTestId(T view, String testId) {
|
||||
view.setTag(R.id.react_test_id, testId);
|
||||
|
||||
// temporarily set the tag and keyed tags to avoid end to end test regressions
|
||||
view.setTag(testId);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,4 +27,13 @@ android_resource(
|
||||
],
|
||||
)
|
||||
|
||||
android_resource(
|
||||
name = "uimanager",
|
||||
package = "com.facebook.react",
|
||||
res = "views/uimanager",
|
||||
visibility = [
|
||||
"PUBLIC",
|
||||
],
|
||||
)
|
||||
|
||||
# New resource directories must be added to react-native-github/ReactAndroid/build.gradle
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- tag is used to store the testID tag -->
|
||||
<item type="id" name="react_test_id"/>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user