mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 03:56:03 +00:00
Add debug tool to get shadowView from UIView
Reviewed By: nicklockwood Differential Revision: D3058618 fb-gh-sync-id: 8e6c0ad328fa767f43438c9461b8374d1279931b shipit-source-id: 8e6c0ad328fa767f43438c9461b8374d1279931b
This commit is contained in:
parent
0be6031bc6
commit
bebd9c423f
@ -905,6 +905,10 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
|
|||||||
[uiManager->_bridgeTransactionListeners addObject:view];
|
[uiManager->_bridgeTransactionListeners addObject:view];
|
||||||
}
|
}
|
||||||
((NSMutableDictionary<NSNumber *, UIView *> *)viewRegistry)[reactTag] = view;
|
((NSMutableDictionary<NSNumber *, UIView *> *)viewRegistry)[reactTag] = view;
|
||||||
|
|
||||||
|
#if RCT_DEV
|
||||||
|
[view _DEBUG_setReactShadowView:shadowView];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@class RCTShadowView;
|
||||||
|
|
||||||
#import "RCTComponent.h"
|
#import "RCTComponent.h"
|
||||||
|
|
||||||
//TODO: let's try to eliminate this category if possible
|
//TODO: let's try to eliminate this category if possible
|
||||||
@ -49,4 +51,11 @@
|
|||||||
- (void)reactDidMakeFirstResponder;
|
- (void)reactDidMakeFirstResponder;
|
||||||
- (BOOL)reactRespondsToTouch:(UITouch *)touch;
|
- (BOOL)reactRespondsToTouch:(UITouch *)touch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Tools for debugging
|
||||||
|
*/
|
||||||
|
#if RCT_DEV
|
||||||
|
@property (nonatomic, strong, setter=_DEBUG_setReactShadowView:) RCTShadowView *_DEBUG_reactShadowView;
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#import "RCTAssert.h"
|
#import "RCTAssert.h"
|
||||||
#import "RCTLog.h"
|
#import "RCTLog.h"
|
||||||
|
#import "RCTShadowView.h"
|
||||||
|
|
||||||
@implementation UIView (React)
|
@implementation UIView (React)
|
||||||
|
|
||||||
@ -26,6 +27,21 @@
|
|||||||
objc_setAssociatedObject(self, @selector(reactTag), reactTag, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(self, @selector(reactTag), reactTag, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RCT_DEBUG
|
||||||
|
|
||||||
|
- (RCTShadowView *)_DEBUG_reactShadowView
|
||||||
|
{
|
||||||
|
return objc_getAssociatedObject(self, _cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_DEBUG_setReactShadowView:(RCTShadowView *)shadowView
|
||||||
|
{
|
||||||
|
// Use assign to avoid keeping the shadowView alive it if no longer exists
|
||||||
|
objc_setAssociatedObject(self, @selector(_DEBUG_reactShadowView), shadowView, OBJC_ASSOCIATION_ASSIGN);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
- (BOOL)isReactRootView
|
- (BOOL)isReactRootView
|
||||||
{
|
{
|
||||||
return RCTIsReactRootView(self.reactTag);
|
return RCTIsReactRootView(self.reactTag);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user