From 144818b624dfedd473b1a035d181484eb5ed84a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Sta=C5=9B?= Date: Wed, 8 Apr 2020 13:55:34 +0200 Subject: [PATCH] Revert "Apply topBar appearance options on current child navigationItem (#5994)" This reverts commit 661cfba685825590f5e0dae27d3ae8fd3497d6a0. --- lib/ios/RNNBasePresenter.h | 2 - lib/ios/RNNBasePresenter.m | 4 -- lib/ios/RNNComponentViewController.m | 3 -- lib/ios/TopBarAppearancePresenter.m | 39 +++++++------------ lib/ios/TopBarPresenter.h | 2 - .../RNNRootViewControllerTest.m | 36 ++++++++--------- .../NavigationTests/RNNStackControllerTest.m | 3 +- .../NavigationTests/RNNStackPresenterTest.m | 9 ++--- .../TopBarAppearancePresenterTest.m | 7 ++-- .../utils/RNNComponentViewController+Utils.h | 8 ---- .../utils/RNNComponentViewController+Utils.m | 11 ------ .../ios/playground.xcodeproj/project.pbxproj | 6 --- 12 files changed, 41 insertions(+), 89 deletions(-) delete mode 100644 playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.h delete mode 100644 playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.m diff --git a/lib/ios/RNNBasePresenter.h b/lib/ios/RNNBasePresenter.h index 9f2c5e65950..970a38d0649 100644 --- a/lib/ios/RNNBasePresenter.h +++ b/lib/ios/RNNBasePresenter.h @@ -39,8 +39,6 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void); - (void)componentDidDisappear; -- (UINavigationItem *)currentNavigationItem; - - (UIStatusBarStyle)getStatusBarStyle:(RNNNavigationOptions *)resolvedOptions; - (UIInterfaceOrientationMask)getOrientation:(RNNNavigationOptions *)options; diff --git a/lib/ios/RNNBasePresenter.m b/lib/ios/RNNBasePresenter.m index 25c694605c5..399c9b1bbf1 100644 --- a/lib/ios/RNNBasePresenter.m +++ b/lib/ios/RNNBasePresenter.m @@ -110,10 +110,6 @@ - (UIStatusBarStyle)getStatusBarStyle:(RNNNavigationOptions *)resolvedOptions { } } -- (UINavigationItem *)currentNavigationItem { - return self.boundViewController.getCurrentChild.navigationItem; -} - - (UIInterfaceOrientationMask)getOrientation:(RNNNavigationOptions *)options { return [options withDefault:[self defaultOptions]].layout.supportedOrientations; } diff --git a/lib/ios/RNNComponentViewController.m b/lib/ios/RNNComponentViewController.m index e360a862938..17169897299 100644 --- a/lib/ios/RNNComponentViewController.m +++ b/lib/ios/RNNComponentViewController.m @@ -8,9 +8,6 @@ @implementation RNNComponentViewController - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo rootViewCreator:(id)creator eventEmitter:(RNNEventEmitter *)eventEmitter presenter:(RNNComponentPresenter *)presenter options:(RNNNavigationOptions *)options defaultOptions:(RNNNavigationOptions *)defaultOptions { self = [super initWithLayoutInfo:layoutInfo creator:creator options:options defaultOptions:defaultOptions presenter:presenter eventEmitter:eventEmitter childViewControllers:nil]; self.extendedLayoutIncludesOpaqueBars = YES; - if (@available(iOS 13.0, *)) { - self.navigationItem.standardAppearance = [UINavigationBarAppearance new]; - } return self; } diff --git a/lib/ios/TopBarAppearancePresenter.m b/lib/ios/TopBarAppearancePresenter.m index 92dd8aed387..091bf0af06c 100644 --- a/lib/ios/TopBarAppearancePresenter.m +++ b/lib/ios/TopBarAppearancePresenter.m @@ -1,25 +1,20 @@ #import "TopBarAppearancePresenter.h" #import "RNNFontAttributesCreator.h" -#import "UIViewController+LayoutProtocol.h" @interface TopBarAppearancePresenter () @end -@implementation TopBarAppearancePresenter - -- (void)applyOptions:(RNNTopBarOptions *)options { - [self setTranslucent:[options.background.translucent getWithDefaultValue:NO]]; - [self setBackgroundColor:[options.background.color getWithDefaultValue:nil]]; - [self setTitleAttributes:options.title]; - [self setLargeTitleAttributes:options.largeTitle]; - [self showBorder:![options.noBorder getWithDefaultValue:NO]]; - [self setBackButtonOptions:options.backButton]; +@implementation TopBarAppearancePresenter { + UINavigationBarAppearance* _appearance; } -- (void)applyOptionsBeforePopping:(RNNTopBarOptions *)options { - [self setBackgroundColor:[options.background.color getWithDefaultValue:nil]]; +- (instancetype)initWithNavigationController:(UINavigationController *)boundNavigationController { + self = [super initWithNavigationController:boundNavigationController]; + _appearance = boundNavigationController.navigationBar.standardAppearance ?: [UINavigationBarAppearance new]; + boundNavigationController.navigationBar.standardAppearance = _appearance; + return self; } - (void)setTranslucent:(BOOL)translucent { @@ -33,23 +28,23 @@ - (void)setTransparent:(BOOL)transparent { - (void)updateBackgroundAppearance { if (self.transparent) { - [self.getAppearance configureWithTransparentBackground]; + [_appearance configureWithTransparentBackground]; } else if (self.backgroundColor) { - [self.getAppearance setBackgroundColor:self.backgroundColor]; + [_appearance setBackgroundColor:self.backgroundColor]; } else if (self.translucent) { - [self.getAppearance configureWithDefaultBackground]; + [_appearance configureWithDefaultBackground]; } else { - [self.getAppearance configureWithOpaqueBackground]; + [_appearance configureWithOpaqueBackground]; } } - (void)showBorder:(BOOL)showBorder { UIColor* shadowColor = showBorder ? [[UINavigationBarAppearance new] shadowColor] : nil; - self.getAppearance.shadowColor = shadowColor; + _appearance.shadowColor = shadowColor; } - (void)setBackIndicatorImage:(UIImage *)image withColor:(UIColor *)color { - [self.getAppearance setBackIndicatorImage:image transitionMaskImage:image]; + [_appearance setBackIndicatorImage:image transitionMaskImage:image]; } - (void)setTitleAttributes:(RNNTitleOptions *)titleOptions { @@ -58,7 +53,7 @@ - (void)setTitleAttributes:(RNNTitleOptions *)titleOptions { NSNumber* fontSize = [titleOptions.fontSize getWithDefaultValue:nil]; UIColor* fontColor = [titleOptions.color getWithDefaultValue:nil]; - self.getAppearance.titleTextAttributes = [RNNFontAttributesCreator createFromDictionary:self.getAppearance.titleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:fontColor defaultColor:nil]; + _appearance.titleTextAttributes = [RNNFontAttributesCreator createFromDictionary:_appearance.titleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:fontColor defaultColor:nil]; } - (void)setLargeTitleAttributes:(RNNLargeTitleOptions *)largeTitleOptions { @@ -67,11 +62,7 @@ - (void)setLargeTitleAttributes:(RNNLargeTitleOptions *)largeTitleOptions { NSNumber* fontSize = [largeTitleOptions.fontSize getWithDefaultValue:nil]; UIColor* fontColor = [largeTitleOptions.color getWithDefaultValue:nil]; - self.getAppearance.largeTitleTextAttributes = [RNNFontAttributesCreator createFromDictionary:self.getAppearance.largeTitleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:fontColor defaultColor:nil]; -} - -- (UINavigationBarAppearance *)getAppearance { - return self.currentNavigationItem.standardAppearance; + _appearance.largeTitleTextAttributes = [RNNFontAttributesCreator createFromDictionary:_appearance.largeTitleTextAttributes fontFamily:fontFamily fontSize:fontSize defaultFontSize:nil fontWeight:fontWeight color:fontColor defaultColor:nil]; } @end diff --git a/lib/ios/TopBarPresenter.h b/lib/ios/TopBarPresenter.h index 7ce79683767..a5eadbd159c 100644 --- a/lib/ios/TopBarPresenter.h +++ b/lib/ios/TopBarPresenter.h @@ -13,8 +13,6 @@ - (BOOL)transparent; -- (void)setBackButtonOptions:(RNNBackButtonOptions *)backButtonOptions; - @property (nonatomic) BOOL translucent; @property (nonatomic, strong) UIColor* backgroundColor; diff --git a/playground/ios/NavigationTests/RNNRootViewControllerTest.m b/playground/ios/NavigationTests/RNNRootViewControllerTest.m index 297dc5084b1..dbca9dfd939 100644 --- a/playground/ios/NavigationTests/RNNRootViewControllerTest.m +++ b/playground/ios/NavigationTests/RNNRootViewControllerTest.m @@ -60,7 +60,7 @@ - (void)testTopBarBackgroundColor_validColor { [self.uut viewWillAppear:false]; UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.backgroundColor isEqual:expectedColor]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.backgroundColor isEqual:expectedColor]); } - (void)testTopBarBackgroundColorWithoutNavigationController { @@ -127,7 +127,7 @@ - (void)testTopBarTextColor_validColor{ __unused RNNStackController* nav = [self createNavigationController]; [self.uut viewWillAppear:false]; UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]); } - (void)testBackgroundColor_validColor { @@ -149,7 +149,7 @@ - (void)testTopBarTextFontFamily_validFont{ self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont]; [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithName:inputFont size:17]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); } - (void)testTopBarHideOnScroll_true { @@ -165,8 +165,8 @@ - (void)testTopBarTranslucent { self.options.topBar.background.translucent = [[Bool alloc] initWithValue:topBarTranslucentInput]; __unused RNNStackController* nav = [self createNavigationController]; [self.uut viewWillAppear:false]; - XCTAssertTrue(CGColorEqualToColor(self.uut.navigationItem.standardAppearance.shadowColor.CGColor, [UINavigationBarAppearance new].shadowColor.CGColor)); - XCTAssertTrue(CGColorEqualToColor(self.uut.navigationItem.standardAppearance.backgroundColor.CGColor, UIColor.systemBackgroundColor.CGColor)); + XCTAssertTrue(CGColorEqualToColor(self.uut.navigationController.navigationBar.standardAppearance.shadowColor.CGColor, [UINavigationBarAppearance new].shadowColor.CGColor)); + XCTAssertTrue(CGColorEqualToColor(self.uut.navigationController.navigationBar.standardAppearance.backgroundColor.CGColor, UIColor.systemBackgroundColor.CGColor)); } - (void)testTopBarTransparent { @@ -218,7 +218,7 @@ - (void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withoutTextColor { UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"]; [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); } - (void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withTextColor { @@ -231,8 +231,8 @@ - (void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withTextColor { [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue]; UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); - XCTAssertTrue([self.uut.navigationItem.standardAppearance.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]); } - (void)testTopBarLargeTitleFontSize_withTextFontFamily_withTextColor { @@ -247,8 +247,8 @@ - (void)testTopBarLargeTitleFontSize_withTextFontFamily_withTextColor { [self.uut viewWillAppear:false]; UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; UIFont* expectedFont = [UIFont fontWithName:inputFont size:15]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); - XCTAssertTrue([self.uut.navigationItem.standardAppearance.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]); } - (void)testTopBarLargeTitleFontSize_withTextFontFamily_withoutTextColor { @@ -259,7 +259,7 @@ - (void)testTopBarLargeTitleFontSize_withTextFontFamily_withoutTextColor { __unused RNNStackController* nav = [self createNavigationController]; [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithName:inputFont size:15]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]); } @@ -270,7 +270,7 @@ - (void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor { UIFont* initialFont = self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"]; [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); } - (void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor { @@ -283,8 +283,8 @@ - (void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor { [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithDescriptor:initialFont.fontDescriptor size:topBarTextFontSizeInput.floatValue]; UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]); } - (void)testTopBarTextFontSize_withTextFontFamily_withTextColor { @@ -298,8 +298,8 @@ - (void)testTopBarTextFontSize_withTextFontFamily_withTextColor { [self.uut viewWillAppear:false]; UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1]; UIFont* expectedFont = [UIFont fontWithName:inputFont size:15]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]); } - (void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor { @@ -310,7 +310,7 @@ - (void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor { __unused RNNStackController* nav = [self createNavigationController]; [self.uut viewWillAppear:false]; UIFont* expectedFont = [UIFont fontWithName:inputFont size:15]; - XCTAssertTrue([self.uut.navigationItem.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); + XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSFont"] isEqual:expectedFont]); } // TODO: Currently not passing @@ -468,7 +468,7 @@ - (void)testTopBarNoBorderOn { self.options.topBar.noBorder = [[Bool alloc] initWithValue:topBarNoBorderInput]; __unused RNNStackController* nav = [self createNavigationController]; [self.uut viewWillAppear:false]; - XCTAssertNil(self.uut.navigationItem.standardAppearance.shadowColor); + XCTAssertNil(self.uut.navigationController.navigationBar.standardAppearance.shadowColor); } - (void)testTopBarNoBorderOff { diff --git a/playground/ios/NavigationTests/RNNStackControllerTest.m b/playground/ios/NavigationTests/RNNStackControllerTest.m index ea2acae7703..b62a02caeab 100644 --- a/playground/ios/NavigationTests/RNNStackControllerTest.m +++ b/playground/ios/NavigationTests/RNNStackControllerTest.m @@ -137,8 +137,7 @@ - (void)testPopViewControllerSetTopBarBackgroundForPoppingViewController { [_vc1 overrideOptions:_options]; [self.uut popViewControllerAnimated:NO]; - [_vc1 viewWillAppear:YES]; - XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, self.uut.childViewControllers.lastObject.navigationItem.standardAppearance.backgroundColor); + XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, self.uut.navigationBar.standardAppearance.backgroundColor); } - (void)testPopViewControllerSetDefaultTopBarBackgroundForPoppingViewController { diff --git a/playground/ios/NavigationTests/RNNStackPresenterTest.m b/playground/ios/NavigationTests/RNNStackPresenterTest.m index 2be19ea9c50..e4e955d082d 100644 --- a/playground/ios/NavigationTests/RNNStackPresenterTest.m +++ b/playground/ios/NavigationTests/RNNStackPresenterTest.m @@ -1,10 +1,9 @@ #import #import -#import +#import "RNNStackPresenter.h" #import "UINavigationController+RNNOptions.h" #import "RNNStackController.h" #import "UIImage+Utils.h" -#import "RNNComponentViewController+Utils.h" @interface RNNStackPresenterTest : XCTestCase @@ -19,7 +18,7 @@ @implementation RNNStackPresenterTest - (void)setUp { [super setUp]; self.uut = [[RNNStackPresenter alloc] init]; - RNNStackController* stackController = [[RNNStackController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:self.uut eventEmitter:nil childViewControllers:@[[RNNComponentViewController createWithComponentId:@"component1"], [RNNComponentViewController createWithComponentId:@"component2"]]]; + RNNStackController* stackController = [[RNNStackController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:self.uut eventEmitter:nil childViewControllers:@[[UIViewController new], [UIViewController new]]]; self.boundViewController = [OCMockObject partialMockForObject:stackController]; [self.uut bindViewController:self.boundViewController]; self.options = [[RNNNavigationOptions alloc] initEmptyOptions]; @@ -42,7 +41,7 @@ - (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewCont _options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]]; [self.uut applyOptionsBeforePopping:self.options]; - XCTAssertTrue([_boundViewController.childViewControllers.lastObject.navigationItem.standardAppearance.backgroundColor isEqual:[UIColor redColor]]); + XCTAssertTrue([_boundViewController.navigationBar.standardAppearance.backgroundColor isEqual:[UIColor redColor]]); } - (void)testApplyOptionsShouldSetLargeTitleVisible { @@ -99,7 +98,7 @@ - (void)testSetBackButtonIcon_withColor_shouldSetIcon { self.options.topBar.backButton.icon = icon; [self.uut applyOptions:self.options]; XCTAssertEqual(self.boundViewController.viewControllers.firstObject.navigationItem.backBarButtonItem.tintColor, UIColor.redColor); - XCTAssertTrue([self.boundViewController.viewControllers.lastObject.navigationItem.standardAppearance.backIndicatorImage isEqual:image]); + XCTAssertTrue([self.boundViewController.navigationBar.standardAppearance.backIndicatorImage isEqual:image]); } - (void)testBackgroundColor_validColor { diff --git a/playground/ios/NavigationTests/TopBarAppearancePresenterTest.m b/playground/ios/NavigationTests/TopBarAppearancePresenterTest.m index 88eb3aaab51..8716046f9ed 100644 --- a/playground/ios/NavigationTests/TopBarAppearancePresenterTest.m +++ b/playground/ios/NavigationTests/TopBarAppearancePresenterTest.m @@ -4,7 +4,6 @@ #import "UIViewController+RNNOptions.h" #import #import -#import "RNNComponentViewController+Utils.h" @interface TopBarAppearancePresenterTest : XCTestCase @@ -18,7 +17,7 @@ @implementation TopBarAppearancePresenterTest { - (void)setUp { [super setUp]; - _componentViewController = [RNNComponentViewController createWithComponentId:@"componentId"]; + _componentViewController = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil]; _stack = [[RNNStackController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:_uut eventEmitter:nil childViewControllers:@[_componentViewController]]; _uut = [[TopBarAppearancePresenter alloc] initWithNavigationController:_stack]; } @@ -31,8 +30,8 @@ - (void)testMergeOptions_shouldMergeWithDefault { mergeOptions.topBar.title.fontSize = [Number withValue:@(21)]; RNNNavigationOptions* withDefault = [mergeOptions withDefault:defaultOptions]; [_uut mergeOptions:mergeOptions.topBar withDefault:withDefault.topBar]; - XCTAssertEqual(_stack.childViewControllers.lastObject.navigationItem.standardAppearance.titleTextAttributes[NSForegroundColorAttributeName], UIColor.redColor); - UIFont* font = _stack.childViewControllers.lastObject.navigationItem.standardAppearance.titleTextAttributes[NSFontAttributeName]; + XCTAssertEqual(_stack.navigationBar.standardAppearance.titleTextAttributes[NSForegroundColorAttributeName], UIColor.redColor); + UIFont* font = _stack.navigationBar.standardAppearance.titleTextAttributes[NSFontAttributeName]; XCTAssertEqual(font.pointSize, 21); } diff --git a/playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.h b/playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.h deleted file mode 100644 index 7ad33d21c26..00000000000 --- a/playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import - -@interface RNNComponentViewController (Utils) - -+ (RNNComponentViewController *)createWithComponentId:(NSString *)componentId; - -@end diff --git a/playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.m b/playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.m deleted file mode 100644 index fbed8f14f5e..00000000000 --- a/playground/ios/NavigationTests/utils/RNNComponentViewController+Utils.m +++ /dev/null @@ -1,11 +0,0 @@ -#import "RNNComponentViewController+Utils.h" - -@implementation RNNComponentViewController (Utils) - -+ (RNNComponentViewController *)createWithComponentId:(NSString *)componentId { - RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] init]; - layoutInfo.componentId = componentId; - return [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:nil presenter:nil options:nil defaultOptions:nil]; -} - -@end diff --git a/playground/ios/playground.xcodeproj/project.pbxproj b/playground/ios/playground.xcodeproj/project.pbxproj index 334423576d2..483f18bc33f 100644 --- a/playground/ios/playground.xcodeproj/project.pbxproj +++ b/playground/ios/playground.xcodeproj/project.pbxproj @@ -19,7 +19,6 @@ 50996C6823AA477400008F89 /* RNNRootViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 50996C6723AA477400008F89 /* RNNRootViewControllerTest.m */; }; 50996C6923AA487800008F89 /* RNNTestRootViewCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = E58D263D2385888C003F36BA /* RNNTestRootViewCreator.m */; }; 50BCB27623F1A2B100D6C8E5 /* TopBarAppearancePresenterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 50BCB27523F1A26600D6C8E5 /* TopBarAppearancePresenterTest.m */; }; - 50C9A8D4240FB9D000BD699F /* RNNComponentViewController+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 50C9A8D3240FB9D000BD699F /* RNNComponentViewController+Utils.m */; }; 67C681D42B662A53F29C19DA /* Pods_NavigationIOS12Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEE0B5D45FD34FBABC6586CF /* Pods_NavigationIOS12Tests.framework */; }; 9D204F3DC4FBCD81583BF99F /* Pods_playground.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A3340545EAAF11C1F146864 /* Pods_playground.framework */; }; E5046080227748EA00212BD8 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E504607F227748EA00212BD8 /* JavaScriptCore.framework */; }; @@ -93,8 +92,6 @@ 50996C6123AA46DD00008F89 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50996C6723AA477400008F89 /* RNNRootViewControllerTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNRootViewControllerTest.m; sourceTree = ""; }; 50BCB27523F1A26600D6C8E5 /* TopBarAppearancePresenterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TopBarAppearancePresenterTest.m; sourceTree = ""; }; - 50C9A8D2240FB9D000BD699F /* RNNComponentViewController+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNNComponentViewController+Utils.h"; sourceTree = ""; }; - 50C9A8D3240FB9D000BD699F /* RNNComponentViewController+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RNNComponentViewController+Utils.m"; sourceTree = ""; }; 7F8E255E2E08F6ECE7DF6FE3 /* Pods-playground.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-playground.release.xcconfig"; path = "Target Support Files/Pods-playground/Pods-playground.release.xcconfig"; sourceTree = ""; }; 84E32151E3A71C2B7328BCB4 /* Pods_NavigationTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NavigationTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B484A10A046B0046B98A76B5 /* Pods-playground.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-playground.debug.xcconfig"; path = "Target Support Files/Pods-playground/Pods-playground.debug.xcconfig"; sourceTree = ""; }; @@ -296,8 +293,6 @@ E58D26302385888B003F36BA /* RNNTestBase.h */, 501C86B7239FE9C400E0B631 /* UIImage+Utils.h */, 501C86B8239FE9C400E0B631 /* UIImage+Utils.m */, - 50C9A8D2240FB9D000BD699F /* RNNComponentViewController+Utils.h */, - 50C9A8D3240FB9D000BD699F /* RNNComponentViewController+Utils.m */, ); path = utils; sourceTree = ""; @@ -752,7 +747,6 @@ E58D265B2385888C003F36BA /* UIViewController+RNNOptionsTest.m in Sources */, E58D26532385888C003F36BA /* RNNSideMenuPresenterTest.m in Sources */, 50BCB27623F1A2B100D6C8E5 /* TopBarAppearancePresenterTest.m in Sources */, - 50C9A8D4240FB9D000BD699F /* RNNComponentViewController+Utils.m in Sources */, 50647FE323E3196800B92025 /* RNNExternalViewControllerTests.m in Sources */, E58D264D2385888C003F36BA /* RNNOverlayManagerTest.m in Sources */, 501C86B9239FE9C400E0B631 /* UIImage+Utils.m in Sources */,