mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-07 09:19:11 +08:00
For customizing back button image we use platform native functionality that is: `setBackIndicatorImage` on iOS and `setHomeAsUpIndicator` on Android. The reason we don't do that just by setting left item is that we get a couple of things for free such as handling RTL properly, working accessibility features, handling prop for hiding back button and a couple more. Unfortunately there are some downsides to that approach too. We need to install the back button as an Image component from the JS side, and the extract the image payload on the native side to set it with the navigator. This is specifically problematic in DEV mode where images are loaded asynchronously over HTTP from the packager. In order for that to work we had to employ a few hacks (more comments on that in the code).
55 lines
1.7 KiB
Objective-C
55 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;
|
|
@property (nonatomic) BOOL gestureEnabled;
|
|
|
|
+ (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
|