Browse Source

New Feature: adding disabledSimultaneousGesture flag to manage simultaneous gesture recognition (#1777)

Thanh Le 7 years ago
parent
commit
6a2af3ecc0
3 changed files with 7 additions and 0 deletions
  1. 1
    0
      docs/styling-the-navigator.md
  2. 1
    0
      ios/RCCNavigationController.m
  3. 5
    0
      ios/RCCViewController.m

+ 1
- 0
docs/styling-the-navigator.md View File

@@ -78,6 +78,7 @@ this.props.navigator.setStyle({
78 78
   statusBarHidden: false, // make the status bar hidden regardless of nav bar state
79 79
   
80 80
   disabledBackGesture: false, // default: false. Disable the back gesture (swipe gesture) in order to pop the top screen. 
81
+  disabledSimultaneousGesture: true, // default: true. Disable simultaneous gesture recognition.
81 82
   screenBackgroundImageName: '<name of image in Images.xcassets>', // Optional. default screen background image.
82 83
   rootBackgroundImageName: '<name of image in Images.xcassets>', // Static while you transition between screens. Works best with screenBackgroundColor: 'transparent'
83 84
 

+ 1
- 0
ios/RCCNavigationController.m View File

@@ -105,6 +105,7 @@ NSString const *CALLBACK_ASSOCIATED_ID = @"RCCNavigationController.CALLBACK_ASSO
105 105
         [mergedStyle removeObjectForKey:@"autoAdjustScrollViewInsets"];
106 106
         [mergedStyle removeObjectForKey:@"statusBarTextColorSchemeSingleScreen"];
107 107
         [mergedStyle removeObjectForKey:@"disabledBackGesture"];
108
+        [mergedStyle removeObjectForKey:@"disabledSimultaneousGesture"];
108 109
         [mergedStyle removeObjectForKey:@"navBarCustomView"];
109 110
         [mergedStyle removeObjectForKey:@"navBarComponentAlignment"];
110 111
         

+ 5
- 0
ios/RCCViewController.m View File

@@ -783,5 +783,10 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
783 783
   return !disabledBackGestureBool;
784 784
 }
785 785
 
786
+-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
787
+  NSNumber *disabledSimultaneousGesture = self.navigatorStyle[@"disabledSimultaneousGesture"];
788
+  BOOL disabledSimultaneousGestureBool = disabledSimultaneousGesture ? [disabledSimultaneousGesture boolValue] : YES; // make default value of disabledSimultaneousGesture is true
789
+  return !disabledSimultaneousGestureBool;
790
+}
786 791
 
787 792
 @end