react-native-navigation的迁移库

RNNNavigationOptions.m 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #import "RNNNavigationOptions.h"
  2. #import <React/RCTConvert.h>
  3. #import "RNNStackController.h"
  4. #import "RNNBottomTabsController.h"
  5. #import "RNNTopBarOptions.h"
  6. #import "RNNSideMenuController.h"
  7. #import "RNNComponentViewController.h"
  8. #import "RNNSplitViewController.h"
  9. #import "RNNNavigationButtons.h"
  10. #import "RNNSplitViewOptions.h"
  11. #import "UIViewController+RNNOptions.h"
  12. #import "UINavigationController+RNNOptions.h"
  13. @implementation RNNNavigationOptions
  14. - (instancetype)initWithDict:(NSDictionary *)dict {
  15. self = [super init];
  16. self.topBar = [[RNNTopBarOptions alloc] initWithDict:dict[@"topBar"]];
  17. self.bottomTabs = [[RNNBottomTabsOptions alloc] initWithDict:dict[@"bottomTabs"]];
  18. self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:dict[@"bottomTab"]];
  19. self.topTabs = [[RNNTopTabsOptions alloc] initWithDict:dict[@"topTabs"]];
  20. self.topTab = [[RNNTopTabOptions alloc] initWithDict:dict[@"topTab"]];
  21. self.sideMenu = [[RNNSideMenuOptions alloc] initWithDict:dict[@"sideMenu"]];
  22. self.splitView = [[RNNSplitViewOptions alloc] initWithDict:dict[@"splitView"]];
  23. self.overlay = [[RNNOverlayOptions alloc] initWithDict:dict[@"overlay"]];
  24. self.animations = [[RNNAnimationsOptions alloc] initWithDict:dict[@"animations"]];
  25. self.statusBar = [[RNNStatusBarOptions alloc] initWithDict:dict[@"statusBar"]];
  26. self.preview = [[RNNPreviewOptions alloc] initWithDict:dict[@"preview"]];
  27. self.layout = [[RNNLayoutOptions alloc] initWithDict:dict[@"layout"]];
  28. self.modal = [[RNNModalOptions alloc] initWithDict:dict[@"modal"]];
  29. self.deprecations = [[DeprecationOptions alloc] initWithDict:dict[@"deprecations"]];
  30. self.window = [[WindowOptions alloc] initWithDict:dict[@"window"]];
  31. self.popGesture = [[Bool alloc] initWithValue:dict[@"popGesture"]];
  32. self.backgroundImage = [ImageParser parse:dict key:@"backgroundImage"];
  33. self.rootBackgroundImage = [ImageParser parse:dict key:@"rootBackgroundImage"];
  34. self.modalPresentationStyle = [[Text alloc] initWithValue:dict[@"modalPresentationStyle"]];
  35. self.modalTransitionStyle = [[Text alloc] initWithValue:dict[@"modalTransitionStyle"]];
  36. return self;
  37. }
  38. + (instancetype)emptyOptions {
  39. return [[RNNNavigationOptions alloc] initEmptyOptions];
  40. }
  41. - (instancetype)initEmptyOptions {
  42. self = [self initWithDict:@{}];
  43. return self;
  44. }
  45. - (RNNNavigationOptions *)copy {
  46. RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  47. [newOptions overrideOptions:self];
  48. return newOptions;
  49. }
  50. - (RNNNavigationOptions *)withDefault:(RNNNavigationOptions *)defaultOptions {
  51. return (RNNNavigationOptions *)[super withDefault:defaultOptions];
  52. }
  53. @end