mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-08 22:42:05 +08: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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user