react-native-navigation的迁移库

BottomTabsAttachModeFactory.m 936B

123456789101112131415161718192021222324252627282930
  1. #import "BottomTabsAttachModeFactory.h"
  2. #import "BottomTabsTogetherAttacher.h"
  3. #import "BottomTabsOnSwitchToTabAttacher.h"
  4. #import "BottomTabsAfterInitialTabAttacher.h"
  5. @implementation BottomTabsAttachModeFactory
  6. - (instancetype)initWithDefaultOptions:(RNNNavigationOptions *)defaultOptions {
  7. self = [super init];
  8. _defaultOptions = defaultOptions;
  9. return self;
  10. }
  11. - (BottomTabsBaseAttacher *)fromOptions:(RNNNavigationOptions *)options {
  12. AttachMode attachMode = [[options withDefault:_defaultOptions].bottomTabs.tabsAttachMode getWithDefaultValue:@"together"];
  13. switch (attachMode) {
  14. case BottomTabsAttachModeAfterInitialTab: {
  15. return [BottomTabsAfterInitialTabAttacher new];
  16. }
  17. case BottomTabsAttachModeOnSwitchToTab: {
  18. return [BottomTabsOnSwitchToTabAttacher new];
  19. }
  20. default:
  21. return [BottomTabsTogetherAttacher new];
  22. break;
  23. }
  24. }
  25. @end