Commit 37ad32e7 authored by ColdPaleLight's avatar ColdPaleLight

fix pop gesture problem

parent 3e46fc3a
......@@ -95,9 +95,19 @@
pageInfo[@"uniqueId"] = [FlutterBoostPlugin sharedInstance].fPageId;
if(result) result(pageInfo);
} else if([@"disablePopGesture" isEqualToString:call.method]) {
[FlutterBoostPlugin sharedInstance].application.flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = NO;
FLBFlutterViewContainer *flutterViewController = [FlutterBoostPlugin sharedInstance].application.flutterViewController;
if ([flutterViewController isKindOfClass:flutterViewController.class]) {
flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = NO;
flutterViewController.disablePopGesture = @(YES);
}
} else if([@"enablePopGesture" isEqualToString:call.method]){
[FlutterBoostPlugin sharedInstance].application.flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = YES;
FLBFlutterViewContainer *flutterViewController = [FlutterBoostPlugin sharedInstance].application.flutterViewController;
if ([flutterViewController isKindOfClass:flutterViewController.class]) {
flutterViewController.navigationController.interactivePopGestureRecognizer.enabled = YES;
flutterViewController.disablePopGesture = @(NO);
}
} else{
result(FlutterMethodNotImplemented);
}
......
......@@ -29,6 +29,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface FLBFlutterViewContainer : FlutterViewController<FLBFlutterContainer>
@property (nonatomic,copy,readwrite) NSString *name;
@property (nonatomic, strong) NSNumber *disablePopGesture;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (void)surfaceUpdated:(BOOL)appeared;
@end
......
......@@ -275,6 +275,14 @@ static NSUInteger kInstanceCounter = 0;
[self surfaceUpdated:YES];
[super viewDidAppear:animated];
// Enable or disable pop gesture
// note: if disablePopGesture is nil, do nothing
if (self.disablePopGesture) {
self.navigationController.interactivePopGestureRecognizer.enabled = ![self.disablePopGesture boolValue];
}
}
- (void)viewWillDisappear:(BOOL)animated
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment