File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
playground/ios/NavigationTests Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ - (void)mergeOptions:(RNNNavigationOptions *)mergeOptions
3838
3939- (void )createTabBarItem : (UIViewController *)child
4040 bottomTabOptions : (RNNBottomTabOptions *)bottomTabOptions {
41- child.tabBarItem = [_tabCreator createTabBarItem: bottomTabOptions mergeItem: child.tabBarItem];
41+ UITabBarItem *updatedItem = [_tabCreator createTabBarItem: bottomTabOptions mergeItem: child.tabBarItem];
42+ if (updatedItem != child.tabBarItem ) {
43+ child.tabBarItem = updatedItem;
44+ }
4245}
4346
4447@end
Original file line number Diff line number Diff line change 55@implementation RNNTabBarItemCreator
66
77- (UITabBarItem *)createTabBarItem : (UITabBarItem *)mergeItem {
8- return [UITabBarItem new ];
8+ return mergeItem ?: [UITabBarItem new ];
99}
1010
1111- (UITabBarItem *)createTabBarItem : (RNNBottomTabOptions *)bottomTabOptions
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ - (void)testMergeOptions_shouldSetTabBarItemColorWithDefaultOptions {
5757 XCTAssertEqual (self.componentViewController .tabBarItem .title , @" title" );
5858}
5959
60- - (void )testMergeOptions_shouldCreateNewTabBarItemInstance {
60+ - (void )testMergeOptions_shouldReuseExistingTabBarItemInstance {
6161 RNNNavigationOptions *defaultOptions = [RNNNavigationOptions emptyOptions ];
6262 defaultOptions.bottomTab .selectedIconColor = [Color withColor: UIColor.greenColor];
6363 self.uut .defaultOptions = defaultOptions;
@@ -69,8 +69,8 @@ - (void)testMergeOptions_shouldCreateNewTabBarItemInstance {
6969 [self .uut mergeOptions: mergeOptions
7070 resolvedOptions: self .options
7171 child: self .componentViewController];
72- UITabBarItem *newTabBarItem = self.componentViewController .tabBarItem ;
73- XCTAssertNotEqual (currentTabBarItem, newTabBarItem );
72+ UITabBarItem *updatedTabBarItem = self.componentViewController .tabBarItem ;
73+ XCTAssertEqual (currentTabBarItem, updatedTabBarItem );
7474}
7575
7676@end
You can’t perform that action at this time.
0 commit comments