mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Implement nativeID prop to allow native code to reference react managed views in iOS
Reviewed By: javache Differential Revision: D5228055 fbshipit-source-id: 8c934501d4ac946d80bf93d2ddb50f5fc38aea3c
This commit is contained in:
committed by
Facebook Github Bot
parent
d217921b5e
commit
70e0455522
@@ -114,6 +114,8 @@ RCT_EXPORT_VIEW_PROPERTY(hasTVPreferredFocus, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(tvParallaxProperties, NSDictionary)
|
||||
#endif
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(nativeID, NSString)
|
||||
|
||||
// Acessibility related properties
|
||||
RCT_REMAP_VIEW_PROPERTY(accessible, reactAccessibilityElement.isAccessibilityElement, BOOL)
|
||||
RCT_REMAP_VIEW_PROPERTY(accessibilityLabel, reactAccessibilityElement.accessibilityLabel, NSString)
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex NS_REQUIRES_SUPER;
|
||||
- (void)removeReactSubview:(UIView *)subview NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* The native id of the view, used to locate view from native codes
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *nativeID;
|
||||
|
||||
/**
|
||||
* Layout direction of the view.
|
||||
* Internally backed to `semanticContentAttribute` property.
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
objc_setAssociatedObject(self, @selector(reactTag), reactTag, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (NSNumber *)nativeID
|
||||
{
|
||||
return objc_getAssociatedObject(self, _cmd);
|
||||
}
|
||||
|
||||
- (void)setNativeID:(NSNumber *)nativeID
|
||||
{
|
||||
objc_setAssociatedObject(self, @selector(nativeID), nativeID, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
#if RCT_DEV
|
||||
|
||||
- (RCTShadowView *)_DEBUG_reactShadowView
|
||||
|
||||
Reference in New Issue
Block a user