react-native-navigation的迁移库

RNNNavigationOptions.m 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #import "RNNNavigationOptions.h"
  2. #import <React/RCTConvert.h>
  3. #import "RNNNavigationController.h"
  4. #import "RNNTabBarController.h"
  5. #import "RNNTopBarOptions.h"
  6. #import "RNNSideMenuController.h"
  7. #import "RNNRootViewController.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.customTransition = [[RNNAnimationOptions alloc] initWithDict:dict[@"customTransition"]];
  25. self.animations = [[RNNTransitionsOptions alloc] initWithDict:dict[@"animations"]];
  26. self.statusBar = [[RNNStatusBarOptions alloc] initWithDict:dict[@"statusBar"]];
  27. self.preview = [[RNNPreviewOptions alloc] initWithDict:dict[@"preview"]];
  28. self.layout = [[RNNLayoutOptions alloc] initWithDict:dict[@"layout"]];
  29. self.popGesture = [[Bool alloc] initWithValue:dict[@"popGesture"]];
  30. self.backgroundImage = [ImageParser parse:dict key:@"backgroundImage"];
  31. self.rootBackgroundImage = [ImageParser parse:dict key:@"rootBackgroundImage"];
  32. self.modalPresentationStyle = [[Text alloc] initWithValue:dict[@"modalPresentationStyle"]];
  33. self.modalTransitionStyle = [[Text alloc] initWithValue:dict[@"modalTransitionStyle"]];
  34. return self;
  35. }
  36. - (instancetype)initEmptyOptions {
  37. self = [self initWithDict:@{}];
  38. return self;
  39. }
  40. - (RNNOptions *)copy {
  41. RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  42. [newOptions overrideOptions:self];
  43. return newOptions;
  44. }
  45. - (RNNNavigationOptions *)withDefault:(RNNNavigationOptions *)defaultOptions {
  46. return (RNNNavigationOptions *)[super withDefault:defaultOptions];
  47. }
  48. @end