mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-11 22:40:37 +08:00
Add a nativeID prop to allow native code to reference react managed views
Reviewed By: sahrens Differential Revision: D4786713 fbshipit-source-id: af9cef0737c010b429d52d00181c00bd81f13f5b
This commit is contained in:
committed by
Facebook Github Bot
parent
e154117f37
commit
909af08f24
@@ -41,6 +41,7 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
* Used to locate views in end-to-end (UI) tests.
|
||||
*/
|
||||
public static final String PROP_TEST_ID = "testID";
|
||||
public static final String PROP_NATIVE_ID = "nativeID";
|
||||
|
||||
private static MatrixMathHelper.MatrixDecompositionContext sMatrixDecompositionContext =
|
||||
new MatrixMathHelper.MatrixDecompositionContext();
|
||||
@@ -92,6 +93,11 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
|
||||
view.setTag(testId);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_NATIVE_ID)
|
||||
public void setNativeId(T view, String nativeId) {
|
||||
view.setTag(R.id.view_tag_native_id, nativeId);
|
||||
}
|
||||
|
||||
@ReactProp(name = PROP_ACCESSIBILITY_LABEL)
|
||||
public void setAccessibilityLabel(T view, String accessibilityLabel) {
|
||||
view.setContentDescription(accessibilityLabel);
|
||||
|
||||
Reference in New Issue
Block a user