react-native-navigation的迁移库

RNNBottomTabPresenter.m 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. #import "RNNBottomTabPresenter.h"
  2. #import "RNNTabBarItemCreator.h"
  3. @interface RNNBottomTabPresenter()
  4. @property (nonatomic, weak) id bindedViewController;
  5. @property (nonatomic, retain) RNNNavigationOptions* defaultOptions;
  6. @end
  7. @implementation RNNBottomTabPresenter
  8. - (void)bindViewController:(UIViewController *)viewController {
  9. _bindedViewController = viewController;
  10. }
  11. - (void)applyOptions:(RNNNavigationOptions *)options {
  12. UIViewController* viewController = self.bindedViewController;
  13. if ((options.bottomTab.text.hasValue || options.bottomTab.icon.hasValue || options.bottomTab.selectedIcon.hasValue)) {
  14. RNNNavigationOptions* withDefault = (RNNNavigationOptions *)[[options copy] withDefault:self.defaultOptions];
  15. UITabBarItem* tabItem = [RNNTabBarItemCreator updateTabBarItem:viewController.tabBarItem bottomTabOptions:withDefault.bottomTab];
  16. viewController.tabBarItem = tabItem;
  17. [options.bottomTab.text consume];
  18. [options.bottomTab.icon consume];
  19. [options.bottomTab.selectedIcon consume];
  20. }
  21. }
  22. - (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions {
  23. _defaultOptions = defaultOptions;
  24. }
  25. @end