|
12 | 12 | #import <UIKit/UIKit.h> |
13 | 13 | #endif |
14 | 14 |
|
| 15 | +#ifdef RCT_NEW_ARCH_ENABLED |
| 16 | +#import <React/RCTConversions.h> |
| 17 | +#import <React/RCTFabricComponentsPlugins.h> |
| 18 | +#import <React/RCTViewComponentView.h> |
| 19 | + |
| 20 | +#import <react/renderer/components/rngesturehandler_codegen/ComponentDescriptors.h> |
| 21 | +#import <react/renderer/components/rngesturehandler_codegen/EventEmitters.h> |
| 22 | +#import <react/renderer/components/rngesturehandler_codegen/Props.h> |
| 23 | +#import <react/renderer/components/rngesturehandler_codegen/RCTComponentViewHelpers.h> |
| 24 | + |
| 25 | +using namespace facebook::react; |
| 26 | +#endif // RCT_NEW_ARCH_ENABLED |
| 27 | + |
15 | 28 | /** |
16 | 29 | * Gesture Handler Button components overrides standard mechanism used by RN |
17 | 30 | * to determine touch target, which normally would reurn the UIView that is placed |
@@ -82,4 +95,31 @@ - (RNGHUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event |
82 | 95 | } |
83 | 96 | #endif |
84 | 97 |
|
| 98 | +#ifdef RCT_NEW_ARCH_ENABLED |
| 99 | ++ (ComponentDescriptorProvider)componentDescriptorProvider |
| 100 | +{ |
| 101 | + return concreteComponentDescriptorProvider<RNGestureHandlerButtonComponentDescriptor>(); |
| 102 | +} |
| 103 | + |
| 104 | +- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps |
| 105 | +{ |
| 106 | + const auto &newProps = *std::static_pointer_cast<const RNGestureHandlerButtonProps>(props); |
| 107 | + |
| 108 | + self.userEnabled = newProps.enabled; |
| 109 | +#if !TARGET_OS_TV |
| 110 | + self.exclusiveTouch = newProps.exclusive; |
| 111 | +#endif |
| 112 | + self.hitTestEdgeInsets = UIEdgeInsetsMake( |
| 113 | + -newProps.hitSlop.top, -newProps.hitSlop.left, -newProps.hitSlop.bottom, -newProps.hitSlop.right); |
| 114 | + |
| 115 | + [super updateProps:props oldProps:oldProps]; |
| 116 | +} |
| 117 | + |
| 118 | +Class<RCTComponentViewProtocol> RNGestureHandlerButtonCls(void) |
| 119 | +{ |
| 120 | + return RNGestureHandlerButton.class; |
| 121 | +} |
| 122 | + |
| 123 | +#endif // RCT_NEW_ARCH_ENABLED |
| 124 | + |
85 | 125 | @end |
0 commit comments