react-native-navigation的迁移库

RNNBottomTabsOptions.m 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #import "RNNBottomTabsOptions.h"
  2. #import "RNNTabBarController.h"
  3. extern const NSInteger BLUR_TOPBAR_TAG;
  4. @implementation RNNBottomTabsOptions
  5. - (void)applyOn:(UIViewController *)viewController {
  6. if (self.currentTabIndex) {
  7. [viewController.tabBarController setSelectedIndex:[self.currentTabIndex unsignedIntegerValue]];
  8. }
  9. if (self.currentTabId) {
  10. [(RNNTabBarController*)viewController.tabBarController setSelectedIndexByContainerID:self.currentTabId];
  11. }
  12. if (self.hidden) {
  13. [((RNNTabBarController *)viewController.tabBarController) setTabBarHidden:[self.hidden boolValue] animated:[self.animateHide boolValue]];
  14. }
  15. if (self.testID) {
  16. viewController.tabBarController.tabBar.accessibilityIdentifier = self.testID;
  17. }
  18. if (self.drawUnder) {
  19. if ([self.drawUnder boolValue]) {
  20. viewController.edgesForExtendedLayout |= UIRectEdgeBottom;
  21. } else {
  22. viewController.edgesForExtendedLayout &= ~UIRectEdgeBottom;
  23. }
  24. }
  25. [self resetOptions];
  26. }
  27. - (void)resetOptions {
  28. self.currentTabId = nil;
  29. self.currentTabIndex = nil;
  30. }
  31. -(void)mergeWith:(NSDictionary *)otherOptions {
  32. for (id key in otherOptions) {
  33. [self setValue:[otherOptions objectForKey:key] forKey:key];
  34. }
  35. }
  36. @end