Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ + (BOOL)shouldBeRecycled
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
static const auto defaultProps = std::make_shared<const RNGestureHandlerDetectorProps>();
_props = defaultProps;
_moduleId = -1;
_nativeHandlers = [NSMutableSet set];
_attachedHandlers = [NSMutableSet set];
[self setDefaultProps];
}

return self;
Expand Down Expand Up @@ -72,6 +68,15 @@ - (void)willMoveToWindow:(RNGHWindow *)newWindow
}
}

- (void)setDefaultProps
{
static const auto defaultProps = std::make_shared<const RNGestureHandlerDetectorProps>();
_props = defaultProps;
_moduleId = -1;
_nativeHandlers = [NSMutableSet set];
_attachedHandlers = [NSMutableSet set];
}

- (void)dispatchStateChangeEvent:(RNGestureHandlerDetectorEventEmitter::OnGestureHandlerStateChange)event
{
if (_eventEmitter != nullptr) {
Expand Down Expand Up @@ -127,6 +132,13 @@ - (BOOL)shouldAttachGestureToSubview:(NSNumber *)handlerTag
return [[[handlerManager registry] handlerWithTag:handlerTag] wantsToAttachDirectlyToView];
}

- (void)prepareForRecycle
{
[super prepareForRecycle];

[self setDefaultProps];
}

- (void)didAddSubview:(RNGHUIView *)view
{
[super didAddSubview:view];
Expand Down
Loading