12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #import "RNNTabBarPresenter.h"
- #import "UITabBarController+RNNOptions.h"
-
- @implementation RNNTabBarPresenter
-
- - (void)applyOptions:(RNNNavigationOptions *)options {
- UITabBarController* tabBarController = self.bindedViewController;
-
- [tabBarController rnn_setTabBarTestID:[options.bottomTabs.testID getWithDefaultValue:nil]];
- [tabBarController rnn_setTabBarBackgroundColor:[options.bottomTabs.backgroundColor getWithDefaultValue:nil]];
- [tabBarController rnn_setTabBarTranslucent:[options.bottomTabs.translucent getWithDefaultValue:NO]];
- [tabBarController rnn_setTabBarHideShadow:[options.bottomTabs.hideShadow getWithDefaultValue:NO]];
- [tabBarController rnn_setTabBarStyle:[RCTConvert UIBarStyle:[options.bottomTabs.barStyle getWithDefaultValue:@"default"]]];
- [tabBarController rnn_setTabBarVisible:[options.bottomTabs.visible getWithDefaultValue:YES]];
- }
-
- - (void)mergeOptions:(RNNNavigationOptions *)newOptions currentOptions:(RNNNavigationOptions *)currentOptions defaultOptions:(RNNNavigationOptions *)defaultOptions {
- [super mergeOptions:newOptions currentOptions:currentOptions defaultOptions:defaultOptions];
-
- UITabBarController* tabBarController = self.bindedViewController;
-
- if (newOptions.bottomTabs.currentTabIndex.hasValue) {
- [tabBarController rnn_setCurrentTabIndex:newOptions.bottomTabs.currentTabIndex.get];
- [newOptions.bottomTabs.currentTabIndex consume];
- }
-
- if (newOptions.bottomTabs.currentTabId.hasValue) {
- [tabBarController rnn_setCurrentTabID:newOptions.bottomTabs.currentTabId.get];
- [newOptions.bottomTabs.currentTabId consume];
- }
-
- if (newOptions.bottomTabs.testID.hasValue) {
- [tabBarController rnn_setTabBarTestID:newOptions.bottomTabs.testID.get];
- }
-
- if (newOptions.bottomTabs.backgroundColor.hasValue) {
- [tabBarController rnn_setTabBarBackgroundColor:newOptions.bottomTabs.backgroundColor.get];
- }
-
- if (newOptions.bottomTabs.barStyle.hasValue) {
- [tabBarController rnn_setTabBarStyle:[RCTConvert UIBarStyle:newOptions.bottomTabs.barStyle.get]];
- }
-
- if (newOptions.bottomTabs.translucent.hasValue) {
- [tabBarController rnn_setTabBarTranslucent:newOptions.bottomTabs.translucent.get];
- }
-
- if (newOptions.bottomTabs.hideShadow.hasValue) {
- [tabBarController rnn_setTabBarHideShadow:newOptions.bottomTabs.hideShadow.get];
- }
-
- if (newOptions.bottomTabs.visible.hasValue) {
- [tabBarController rnn_setTabBarVisible:newOptions.bottomTabs.visible.get];
- }
- }
-
- @end
|