react-native-navigation的迁移库

RNNTabBarPresenter.m 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #import "RNNTabBarPresenter.h"
  2. #import "UITabBarController+RNNOptions.h"
  3. @implementation RNNTabBarPresenter
  4. - (void)applyOptions:(RNNNavigationOptions *)initialOptions {
  5. [super applyOptions:initialOptions];
  6. RNNNavigationOptions* options = [initialOptions withDefault:self.defaultOptions];
  7. UITabBarController* tabBarController = self.bindedViewController;
  8. [tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
  9. }
  10. - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)resolvedOptions {
  11. [super mergeOptions:options resolvedOptions:resolvedOptions];
  12. UITabBarController* tabBarController = self.bindedViewController;
  13. if (options.bottomTabs.currentTabIndex.hasValue) {
  14. [tabBarController rnn_setCurrentTabIndex:options.bottomTabs.currentTabIndex.get];
  15. [options.bottomTabs.currentTabIndex consume];
  16. }
  17. if (options.bottomTabs.currentTabId.hasValue) {
  18. [tabBarController rnn_setCurrentTabID:options.bottomTabs.currentTabId.get];
  19. [options.bottomTabs.currentTabId consume];
  20. }
  21. if (options.bottomTabs.testID.hasValue) {
  22. [tabBarController rnn_setTabBarTestID:options.bottomTabs.testID.get];
  23. }
  24. if (options.bottomTabs.backgroundColor.hasValue) {
  25. [tabBarController rnn_setTabBarBackgroundColor:options.bottomTabs.backgroundColor.get];
  26. }
  27. if (options.bottomTabs.barStyle.hasValue) {
  28. [tabBarController rnn_setTabBarStyle:[RCTConvert UIBarStyle:options.bottomTabs.barStyle.get]];
  29. }
  30. if (options.bottomTabs.translucent.hasValue) {
  31. [tabBarController rnn_setTabBarTranslucent:options.bottomTabs.translucent.get];
  32. }
  33. if (options.bottomTabs.hideShadow.hasValue) {
  34. [tabBarController rnn_setTabBarHideShadow:options.bottomTabs.hideShadow.get];
  35. }
  36. }
  37. @end