mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-02 09:18:38 +08:00
When you have 2 screens in a stack with the bottom one with gestureEnabled=false using the back gesture causes the screen to become unresponsive. This seems to be caused by setting interactivePopGestureRecognizer.enabled = NO as soon as the gesture starts. This causes the gesture to cancel immediately and leaves the screen in an unresponsive state.
<Stack><Screen gestureEnabled={false} /><Screen /></Stack>
To fix this instead of using interactivePopGestureRecognizer.enabled we can leverage the existing delegate that we have in RNScreenStack. In gestureRecognizerShouldBegin we can check if the top screen has gestures enabled.
To make this simpler I moved the gestureEnabled config to Screen instead of HeaderConfig. I think it also makes more sense conceptually since the gesture is tied to the screen and not the header. It also simplifies the android code a bit.
This is a breaking change.
Update
This now only moves the config to screen since a separate fix was merged for the bug.
54 lines
1.7 KiB
Objective-C
54 lines
1.7 KiB
Objective-C
#import <React/RCTViewManager.h>
|
|
#import <React/RCTConvert.h>
|
|
|
|
#import "RNSScreen.h"
|
|
|
|
@interface RNSScreenStackHeaderConfig : UIView
|
|
|
|
@property (nonatomic, weak) RNSScreenView *screenView;
|
|
|
|
@property (nonatomic, retain) NSString *title;
|
|
@property (nonatomic, retain) NSString *titleFontFamily;
|
|
@property (nonatomic, retain) NSNumber *titleFontSize;
|
|
@property (nonatomic, retain) UIColor *titleColor;
|
|
@property (nonatomic, retain) NSString *backTitle;
|
|
@property (nonatomic, retain) NSString *backTitleFontFamily;
|
|
@property (nonatomic, retain) NSNumber *backTitleFontSize;
|
|
@property (nonatomic, retain) UIColor *backgroundColor;
|
|
@property (nonatomic, retain) UIColor *color;
|
|
@property (nonatomic) BOOL hide;
|
|
@property (nonatomic) BOOL largeTitle;
|
|
@property (nonatomic, retain) NSString *largeTitleFontFamily;
|
|
@property (nonatomic, retain) NSNumber *largeTitleFontSize;
|
|
@property (nonatomic) BOOL hideBackButton;
|
|
@property (nonatomic) BOOL hideShadow;
|
|
@property (nonatomic) BOOL translucent;
|
|
|
|
+ (void)willShowViewController:(UIViewController *)vc withConfig:(RNSScreenStackHeaderConfig*)config;
|
|
|
|
@end
|
|
|
|
@interface RNSScreenStackHeaderConfigManager : RCTViewManager
|
|
|
|
@end
|
|
|
|
typedef NS_ENUM(NSInteger, RNSScreenStackHeaderSubviewType) {
|
|
RNSScreenStackHeaderSubviewTypeBackButton,
|
|
RNSScreenStackHeaderSubviewTypeLeft,
|
|
RNSScreenStackHeaderSubviewTypeRight,
|
|
RNSScreenStackHeaderSubviewTypeTitle,
|
|
RNSScreenStackHeaderSubviewTypeCenter,
|
|
};
|
|
|
|
@interface RCTConvert (RNSScreenStackHeader)
|
|
|
|
+ (RNSScreenStackHeaderSubviewType)RNSScreenStackHeaderSubviewType:(id)json;
|
|
|
|
@end
|
|
|
|
@interface RNSScreenStackHeaderSubviewManager : RCTViewManager
|
|
|
|
@property (nonatomic) RNSScreenStackHeaderSubviewType type;
|
|
|
|
@end
|