Fix the broken target selector
Summary: The target selector was broken on iOS. The overlay view which has the gesture recognizer, was never added to the window, due to which the gestures were not registered and the feature broke. This diff adds the overlay view in the window object as the subview and then discards it in its view descriptor as otherwise we will capture all our touches in this view. This was the most popular bug in our research trip and almost everyone reported it. Reviewed By: fabiomassimo Differential Revision: D20225594 fbshipit-source-id: af4041859d7e662152b2575d1eb258dd0c2d990e
This commit is contained in:
committed by
Facebook Github Bot
parent
31bafadaa3
commit
f03f119f0e
@@ -362,7 +362,7 @@
|
|||||||
if (active) {
|
if (active) {
|
||||||
[_tapListener mountWithFrame:[[UIScreen mainScreen] bounds]];
|
[_tapListener mountWithFrame:[[UIScreen mainScreen] bounds]];
|
||||||
__block id<NSObject> rootNode = _rootNode;
|
__block id<NSObject> rootNode = _rootNode;
|
||||||
|
|
||||||
[_tapListener listenForTapWithBlock:^(CGPoint touchPoint) {
|
[_tapListener listenForTapWithBlock:^(CGPoint touchPoint) {
|
||||||
SKTouch* touch = [[SKTouch alloc]
|
SKTouch* touch = [[SKTouch alloc]
|
||||||
initWithTouchPoint:touchPoint
|
initWithTouchPoint:touchPoint
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
_overlayWindow.hidden = YES;
|
_overlayWindow.hidden = YES;
|
||||||
_overlayWindow.windowLevel = UIWindowLevelAlert;
|
_overlayWindow.windowLevel = UIWindowLevelAlert;
|
||||||
_overlayWindow.backgroundColor = [SKHighlightOverlay overlayColor];
|
_overlayWindow.backgroundColor = [SKHighlightOverlay overlayColor];
|
||||||
|
|
||||||
[_overlayWindow addGestureRecognizer:_gestureRecognizer];
|
[_overlayWindow addGestureRecognizer:_gestureRecognizer];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
[_overlayWindow setFrame:frame];
|
[_overlayWindow setFrame:frame];
|
||||||
[_overlayWindow makeKeyAndVisible];
|
[_overlayWindow makeKeyAndVisible];
|
||||||
_overlayWindow.hidden = NO;
|
_overlayWindow.hidden = NO;
|
||||||
|
[[UIApplication sharedApplication].delegate.window addSubview:_overlayWindow];
|
||||||
_isMounted = YES;
|
_isMounted = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,6 @@
|
|||||||
[_receiversWaitingForInput removeAllObjects];
|
[_receiversWaitingForInput removeAllObjects];
|
||||||
[_overlayWindow removeFromSuperview];
|
[_overlayWindow removeFromSuperview];
|
||||||
_overlayWindow.hidden = YES;
|
_overlayWindow.hidden = YES;
|
||||||
|
|
||||||
_isMounted = NO;
|
_isMounted = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#import <FlipperKitHighlightOverlay/SKHighlightOverlay.h>
|
#import <FlipperKitHighlightOverlay/SKHighlightOverlay.h>
|
||||||
#import <YogaKit/UIView+Yoga.h>
|
#import <YogaKit/UIView+Yoga.h>
|
||||||
#import "SKDescriptorMapper.h"
|
#import "SKDescriptorMapper.h"
|
||||||
|
#import "SKHiddenWindow.h"
|
||||||
#import "SKNamed.h"
|
#import "SKNamed.h"
|
||||||
#import "SKObject.h"
|
#import "SKObject.h"
|
||||||
#import "SKYogaKitHelper.h"
|
#import "SKYogaKitHelper.h"
|
||||||
@@ -492,7 +493,10 @@ static NSDictionary* YGUnitEnumMap = nil;
|
|||||||
viewForNode = (UIView*)childNode;
|
viewForNode = (UIView*)childNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewForNode.isHidden || viewForNode.alpha <= 0) {
|
if (viewForNode.isHidden || viewForNode.alpha <= 0 ||
|
||||||
|
[[viewForNode class] isEqual:[SKHiddenWindow class]]) {
|
||||||
|
/*SKHiddenWindow is the pink overlay which is added in window to capture
|
||||||
|
the gestures.*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user