react-native-navigation的迁移库

RNNNavigationOptions.m 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.customTransition = [[RNNSharedElementAnimationOptions alloc] initWithDict:dict[@"customTransition"]];
  25. self.animations = [[RNNAnimationsOptions 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.modal = [[RNNModalOptions alloc] initWithDict:dict[@"modal"]];
  30. self.popGesture = [[Bool alloc] initWithValue:dict[@"popGesture"]];
  31. self.backgroundImage = [ImageParser parse:dict key:@"backgroundImage"];
  32. self.rootBackgroundImage = [ImageParser parse:dict key:@"rootBackgroundImage"];
  33. self.modalPresentationStyle = [[Text alloc] initWithValue:dict[@"modalPresentationStyle"]];
  34. self.modalTransitionStyle = [[Text alloc] initWithValue:dict[@"modalTransitionStyle"]];
  35. return self;
  36. }
  37. - (instancetype)initEmptyOptions {
  38. self = [self initWithDict:@{}];
  39. return self;
  40. }
  41. - (RNNNavigationOptions *)copy {
  42. RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  43. [newOptions overrideOptions:self];
  44. return newOptions;
  45. }
  46. - (RNNNavigationOptions *)withDefault:(RNNNavigationOptions *)defaultOptions {
  47. return (RNNNavigationOptions *)[super withDefault:defaultOptions];
  48. }
  49. @end