File tree Expand file tree Collapse file tree
packages/react-native-gesture-handler/apple/Handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ - (RNGestureHandlerEventExtraData *)extraDataForView:(UIView *)sender
203203{
204204 RNGHUITouch *touch = [[event allTouches ] anyObject ];
205205 CGPoint position = touch ? [touch locationInView: sender] : CGPointZero;
206- CGPoint absolutePosition = touch ? [touch locationInView: nil ] : CGPointZero;
206+ CGPoint absolutePosition = touch ? [touch locationInView: nil ] : [sender convertPoint: CGPointZero toView: nil ] ;
207207
208208 return [RNGestureHandlerEventExtraData forPointerInside: pointerInside
209209 withPosition: position
@@ -223,10 +223,12 @@ - (void)sendActiveStateEventIfChangedForView:(UIView *)sender extraData:(RNGestu
223223
224224- (void )handleSwitch : (UIView *)sender
225225{
226+ CGPoint center = CGPointMake (CGRectGetMidX (sender.bounds ), CGRectGetMidY (sender.bounds ));
227+ CGPoint absoluteCenter = [sender convertPoint: center toView: nil ];
226228 RNGestureHandlerEventExtraData * (^extraData)(void ) = ^{
227229 return [RNGestureHandlerEventExtraData forPointerInside: YES
228- withPosition: CGPointZero
229- withAbsolutePosition: CGPointZero
230+ withPosition: center
231+ withAbsolutePosition: absoluteCenter
230232 withNumberOfTouches: 1
231233 withPointerType: self ->_pointerType];
232234 };
You can’t perform that action at this time.
0 commit comments