浏览代码

Fix popGesture freezes the app, Closes #4388 (#5009)

Yogev Ben David 5 年前
父节点
当前提交
f74991b8da
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 3 次插入23 次删除
  1. 0
    11
      lib/ios/InteractivePopGestureDelegate.h
  2. 3
    12
      lib/ios/InteractivePopGestureDelegate.m

+ 0
- 11
lib/ios/InteractivePopGestureDelegate.h 查看文件

@@ -1,14 +1,3 @@
1
-//
2
-//  InteractivePopGestureDelegate.h
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Arman Dezfuli-Arjomandi on 1/10/19.
6
-//  Copyright © 2019 Wix. All rights reserved.
7
-//
8
-//
9
-
10
-// This file is adapted from the following StackOverflow answer:
11
-// https://stackoverflow.com/questions/24710258/no-swipe-back-when-hiding-navigation-bar-in-uinavigationcontroller/41895151#41895151
12 1
 
13 2
 #import <UIKit/UIKit.h>
14 3
 

+ 3
- 12
lib/ios/InteractivePopGestureDelegate.m 查看文件

@@ -1,17 +1,12 @@
1
-//
2
-//  InteractivePopGestureDelegate.m
3
-//  ReactNativeNavigation
4
-//
5
-//  Created by Arman Dezfuli-Arjomandi on 1/10/19.
6
-//  Copyright © 2019 Wix. All rights reserved.
7
-//
8 1
 
9 2
 #import "InteractivePopGestureDelegate.h"
10 3
 
11 4
 @implementation InteractivePopGestureDelegate
12 5
 
13 6
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
14
-	if (self.navigationController.navigationBarHidden && self.navigationController.viewControllers.count > 1) {
7
+	if (self.navigationController.viewControllers.count < 2) {
8
+		return NO;
9
+	} else if (self.navigationController.navigationBarHidden) {
15 10
 		return YES;
16 11
 	} else if (!self.navigationController.navigationBarHidden && self.originalDelegate == nil) {
17 12
 		return YES;
@@ -28,8 +23,4 @@
28 23
 	}
29 24
 }
30 25
 
31
-- (id)forwardingTargetForSelector:(SEL)aSelector {
32
-	return self.originalDelegate;
33
-}
34
-
35 26
 @end