diff --git a/lib/ios/TopBarAppearancePresenter.m b/lib/ios/TopBarAppearancePresenter.m
index 56544e72ce0..46fac34e797 100644
--- a/lib/ios/TopBarAppearancePresenter.m
+++ b/lib/ios/TopBarAppearancePresenter.m
@@ -45,10 +45,6 @@ - (void)updateBackgroundAppearance {
}
}
-- (BOOL)transparent {
- return (_backgroundColor && CGColorGetAlpha(_backgroundColor.CGColor) == 0.0);
-}
-
- (void)showBorder:(BOOL)showBorder {
UIColor* shadowColor = showBorder ? [[UINavigationBarAppearance new] shadowColor] : nil;
_appearance.shadowColor = shadowColor;
diff --git a/lib/ios/TopBarPresenter.h b/lib/ios/TopBarPresenter.h
index 1d3ef08da27..5594f7002c6 100644
--- a/lib/ios/TopBarPresenter.h
+++ b/lib/ios/TopBarPresenter.h
@@ -11,7 +11,8 @@
- (instancetype)initWithNavigationController:(UINavigationController *)boundNavigationController;
-@property (nonatomic) BOOL transparent;
+- (BOOL)transparent;
+
@property (nonatomic) BOOL translucent;
@property (nonatomic, strong) UIColor* backgroundColor;
diff --git a/lib/ios/TopBarPresenter.m b/lib/ios/TopBarPresenter.m
index 4e3c320d6a5..8038109b943 100644
--- a/lib/ios/TopBarPresenter.m
+++ b/lib/ios/TopBarPresenter.m
@@ -69,7 +69,7 @@ - (void)setBackgroundColor:(UIColor *)backgroundColor {
}
- (void)updateBackgroundAppearance {
- if (_transparent) {
+ if (self.transparent) {
[self setBackgroundColorTransparent];
} else if (_backgroundColor) {
self.navigationController.navigationBar.barTintColor = _backgroundColor;
@@ -125,4 +125,8 @@ - (void)setBackButtonIcon:(UIImage *)icon withColor:(UIColor *)color title:(NSSt
lastViewControllerInStack.navigationItem.backBarButtonItem = backItem;
}
+- (BOOL)transparent {
+ return (_backgroundColor && CGColorGetAlpha(_backgroundColor.CGColor) == 0.0);
+}
+
@end
diff --git a/playground/ios/NavigationIOS12Tests/Info.plist b/playground/ios/NavigationIOS12Tests/Info.plist
new file mode 100644
index 00000000000..64d65ca4957
--- /dev/null
+++ b/playground/ios/NavigationIOS12Tests/Info.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ $(PRODUCT_BUNDLE_PACKAGE_TYPE)
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1
+
+
diff --git a/playground/ios/NavigationIOS12Tests/RNNRootViewControllerTest.m b/playground/ios/NavigationIOS12Tests/RNNRootViewControllerTest.m
new file mode 100644
index 00000000000..84493936885
--- /dev/null
+++ b/playground/ios/NavigationIOS12Tests/RNNRootViewControllerTest.m
@@ -0,0 +1,566 @@
+#import
+#import
+#import
+#import "RNNReactRootViewCreator.h"
+#import "RNNTestRootViewCreator.h"
+#import
+#import "RNNNavigationOptions.h"
+#import "RNNStackController.h"
+#import "RNNBottomTabsController.h"
+#import "RNNUIBarButtonItem.h"
+
+
+@interface RNNComponentViewController (EmbedInTabBar)
+- (void)embedInTabBarController;
+@end
+
+@implementation RNNComponentViewController (EmbedInTabBar)
+
+- (void)embedInTabBarController {
+ RNNBottomTabsController* tabVC = [[RNNBottomTabsController alloc] init];
+ tabVC.viewControllers = @[self];
+ [self viewWillAppear:false];
+}
+
+@end
+
+@interface RNNRootViewControllerTest : XCTestCase
+
+@property (nonatomic, strong) id creator;
+@property (nonatomic, strong) NSString* pageName;
+@property (nonatomic, strong) NSString* componentId;
+@property (nonatomic, strong) id emitter;
+@property (nonatomic, strong) RNNNavigationOptions* options;
+@property (nonatomic, strong) RNNLayoutInfo* layoutInfo;
+@property (nonatomic, strong) RNNComponentViewController* uut;
+@end
+
+@implementation RNNRootViewControllerTest
+
+- (void)setUp {
+ [super setUp];
+ self.creator = [[RNNTestRootViewCreator alloc] init];
+ self.pageName = @"somename";
+ self.componentId = @"cntId";
+ self.emitter = nil;
+ self.options = [[RNNNavigationOptions alloc] initWithDict:@{}];
+
+ RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
+ layoutInfo.componentId = self.componentId;
+ layoutInfo.name = self.pageName;
+
+ id presenter = [OCMockObject partialMockForObject:[[RNNComponentPresenter alloc] init]];
+ self.uut = [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:self.creator eventEmitter:self.emitter presenter:presenter options:self.options defaultOptions:nil];
+}
+
+-(void)testTopBarBackgroundColor_validColor{
+ NSNumber* inputColor = @(0xFFFF0000);
+ self.options.topBar.background.color = [[Color alloc] initWithValue:[RCTConvert UIColor:inputColor]];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
+
+ XCTAssertTrue([self.uut.navigationController.navigationBar.barTintColor isEqual:expectedColor]);
+}
+
+-(void)testTopBarBackgroundColorWithoutNavigationController{
+ NSNumber* inputColor = @(0xFFFF0000);
+ self.options.topBar.background.color = [[Color alloc] initWithValue:[RCTConvert UIColor:inputColor]];
+
+ XCTAssertNoThrow([self.uut viewWillAppear:false]);
+}
+
+- (void)testStatusBarHidden_default {
+ [self.uut viewWillAppear:false];
+
+ XCTAssertFalse([self.uut prefersStatusBarHidden]);
+}
+
+- (void)testStatusBarVisible_false {
+ self.options.statusBar.visible = [[Bool alloc] initWithValue:@(0)];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertTrue([self.uut prefersStatusBarHidden]);
+}
+
+- (void)testStatusBarVisible_true {
+ self.options.statusBar.visible = [[Bool alloc] initWithValue:@(1)];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertFalse([self.uut prefersStatusBarHidden]);
+}
+
+- (void)testStatusBarHideWithTopBar_false {
+ self.options.statusBar.hideWithTopBar = [[Bool alloc] initWithValue:@(0)];
+ self.options.topBar.visible = [[Bool alloc] initWithValue:@(0)];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertFalse([self.uut prefersStatusBarHidden]);
+}
+
+- (void)testStatusBarHideWithTopBar_true {
+ self.options.statusBar.hideWithTopBar = [[Bool alloc] initWithValue:@(1)];
+ self.options.topBar.visible = [[Bool alloc] initWithValue:@(0)];
+ __unused RNNStackController* nav = [self createNavigationController];
+
+ [self.uut viewWillAppear:false];
+
+ XCTAssertTrue([self.uut prefersStatusBarHidden]);
+}
+
+-(void)testTitle_string{
+ NSString* title =@"some title";
+ self.options.topBar.title.text = [[Text alloc] initWithValue:title];
+
+ [self.uut viewWillAppear:false];
+ XCTAssertTrue([self.uut.navigationItem.title isEqual:title]);
+}
+
+-(void)testTitle_default{
+ [self.uut viewWillAppear:false];
+ XCTAssertNil(self.uut.navigationItem.title);
+}
+
+-(void)testTopBarTextColor_validColor{
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ self.options.topBar.title.color = [[Color alloc] initWithValue:inputColor];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
+}
+
+-(void)testbackgroundColor_validColor{
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
+ [self.uut viewWillAppear:false];
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
+ XCTAssertTrue([self.uut.view.backgroundColor isEqual:expectedColor]);
+}
+
+-(void)testTopBarTextFontFamily_validFont{
+ NSString* inputFont = @"HelveticaNeue";
+ __unused RNNStackController* nav = [self createNavigationController];
+ self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont fontWithName:inputFont size:17];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+}
+
+-(void)testTopBarHideOnScroll_true {
+ NSNumber* hideOnScrollInput = @(1);
+ __unused RNNStackController* nav = [self createNavigationController];
+ self.options.topBar.hideOnScroll = [[Bool alloc] initWithValue:hideOnScrollInput];;
+ [self.uut viewWillAppear:false];
+ XCTAssertTrue(self.uut.navigationController.hidesBarsOnSwipe);
+}
+
+-(void)testTopBarTranslucent {
+ NSNumber* topBarTranslucentInput = @(0);
+ self.options.topBar.background.translucent = [[Bool alloc] initWithValue:topBarTranslucentInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
+}
+
+-(void)testTabBadge {
+ NSString* tabBadgeInput = @"5";
+ self.options.bottomTab.badge = [[Text alloc] initWithValue:tabBadgeInput];
+ __unused RNNBottomTabsController* vc = [[RNNBottomTabsController alloc] init];
+ NSMutableArray* controllers = [NSMutableArray new];
+ UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
+ [self.uut setTabBarItem:item];
+ [controllers addObject:self.uut];
+ [vc setViewControllers:controllers];
+ [self.uut viewWillAppear:false];
+ XCTAssertTrue([self.uut.tabBarItem.badgeValue isEqualToString:tabBadgeInput]);
+
+}
+
+-(void)testTopBarTransparent_BOOL_True {
+ UIColor* transparentColor = [RCTConvert UIColor:@(0x00000000)];
+ self.options.topBar.background.color = [[Color alloc] initWithValue:transparentColor];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+
+ nav.navigationBar.barTintColor = UIColor.clearColor;
+ XCTAssertTrue([nav.navigationBar.barTintColor isEqual:UIColor.clearColor]);
+}
+
+-(void)testTopBarTransparent_BOOL_false {
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ __unused RNNStackController* nav = [self createNavigationController];
+ self.options.topBar.background.color = [[Color alloc] initWithValue:inputColor];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertFalse([nav.navigationBar.barTintColor isEqual:UIColor.clearColor]);
+}
+
+-(void)testTopBarLargeTitle_default {
+ [self.uut viewWillAppear:false];
+
+ XCTAssertEqual(self.uut.navigationItem.largeTitleDisplayMode, UINavigationItemLargeTitleDisplayModeNever);
+}
+
+-(void)testTopBarLargeTitle_true {
+ self.options.topBar.largeTitle.visible = [[Bool alloc] initWithValue:@(1)];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertEqual(self.uut.navigationItem.largeTitleDisplayMode, UINavigationItemLargeTitleDisplayModeAlways);
+}
+
+-(void)testTopBarLargeTitle_false {
+ self.options.topBar.largeTitle.visible = [[Bool alloc] initWithValue:@(0)];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertEqual(self.uut.navigationItem.largeTitleDisplayMode, UINavigationItemLargeTitleDisplayModeNever);
+}
+
+
+-(void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withoutTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont systemFontOfSize:15];
+
+ XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+}
+
+-(void)testTopBarLargeTitleFontSize_withoutTextFontFamily_withTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ self.options.topBar.largeTitle.color = [[Color alloc] initWithValue:inputColor];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont systemFontOfSize:15];
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+ XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]);
+}
+
+-(void)testTopBarLargeTitleFontSize_withTextFontFamily_withTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ NSString* inputFont = @"HelveticaNeue";
+ self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ self.options.topBar.largeTitle.color = [[Color alloc] initWithValue:inputColor];
+ self.options.topBar.largeTitle.fontFamily = [[Text alloc] initWithValue:inputFont];
+
+ __unused RNNStackController* nav = [self createNavigationController];
+ [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.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+ XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSColor"] isEqual:expectedColor]);
+}
+
+-(void)testTopBarLargeTitleFontSize_withTextFontFamily_withoutTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ NSString* inputFont = @"HelveticaNeue";
+ self.options.topBar.largeTitle.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ self.options.topBar.largeTitle.fontFamily = [[Text alloc] initWithValue:inputFont];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.largeTitleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+}
+
+
+-(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont systemFontOfSize:15];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+}
+
+-(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ self.options.topBar.title.color = [[Color alloc] initWithValue:inputColor];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont systemFontOfSize:15];
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
+}
+
+-(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
+ NSString* inputFont = @"HelveticaNeue";
+ self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ self.options.topBar.title.color = [[Color alloc] initWithValue:inputColor];
+ self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [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.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
+}
+
+-(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
+ NSNumber* topBarTextFontSizeInput = @(15);
+ NSString* inputFont = @"HelveticaNeue";
+ self.options.topBar.title.fontSize = [[Number alloc] initWithValue:topBarTextFontSizeInput];
+ self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
+}
+
+// TODO: Currently not passing
+-(void)testTopBarTextFontFamily_invalidFont{
+ NSString* inputFont = @"HelveticaNeueeeee";
+ __unused RNNStackController* nav = [self createNavigationController];
+ self.options.topBar.title.fontFamily = [[Text alloc] initWithValue:inputFont];
+ // XCTAssertThrows([self.uut viewWillAppear:false]);
+}
+
+-(void)testOrientation_portrait {
+ NSArray* supportedOrientations = @[@"portrait"];
+ self.options.layout.orientation = supportedOrientations;
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
+ XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testOrientation_portraitString {
+ NSString* supportedOrientation = @"portrait";
+ self.options.layout.orientation = supportedOrientation;
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait);
+ XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testOrientation_portraitAndLandscape {
+ NSArray* supportedOrientations = @[@"portrait", @"landscape"];
+ self.options.layout.orientation = supportedOrientations;
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
+ XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testOrientation_all {
+ NSArray* supportedOrientations = @[@"all"];
+ self.options.layout.orientation = supportedOrientations;
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
+ XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testOrientation_default {
+ NSString* supportedOrientations = @"default";
+ self.options.layout.orientation = supportedOrientations;
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ UIInterfaceOrientationMask expectedOrientation = [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:[[UIApplication sharedApplication] keyWindow]];
+ XCTAssertTrue(self.uut.navigationController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+
+-(void)testOrientationTabsController_portrait {
+ NSArray* supportedOrientations = @[@"portrait"];
+ self.options.layout.orientation = supportedOrientations;
+ NSMutableArray* controllers = [[NSMutableArray alloc] initWithArray:@[self.uut]];
+ __unused RNNBottomTabsController* vc = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[RNNComponentPresenter new] eventEmitter:nil childViewControllers:controllers];
+
+ [self.uut viewWillAppear:false];
+
+ UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
+ XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testOrientationTabsController_portraitAndLandscape {
+ NSArray* supportedOrientations = @[@"portrait", @"landscape"];
+ self.options.layout.orientation = supportedOrientations;
+ NSMutableArray* controllers = [[NSMutableArray alloc] initWithArray:@[self.uut]];
+ __unused RNNBottomTabsController* vc = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[RNNComponentPresenter new] eventEmitter:nil childViewControllers:controllers];
+
+ [self.uut viewWillAppear:false];
+
+ UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
+ XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testOrientationTabsController_all {
+ NSArray* supportedOrientations = @[@"all"];
+ self.options.layout.orientation = supportedOrientations;
+ NSMutableArray* controllers = [[NSMutableArray alloc] initWithArray:@[self.uut]];
+ __unused RNNBottomTabsController* vc = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[RNNComponentPresenter new] eventEmitter:nil childViewControllers:controllers];
+
+ [self.uut viewWillAppear:false];
+
+ UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
+ XCTAssertTrue(self.uut.tabBarController.supportedInterfaceOrientations == expectedOrientation);
+}
+
+-(void)testRightButtonsWithTitle_withoutStyle {
+ self.options.topBar.rightButtons = @[@{@"id": @"testId", @"text": @"test"}];
+ self.uut = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[RNNComponentPresenter new] options:self.options defaultOptions:nil];
+ RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:_creator options:nil defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:@[self.uut]];
+
+ RNNUIBarButtonItem* button = (RNNUIBarButtonItem*) nav.topViewController.navigationItem.rightBarButtonItems[0];
+ NSString* expectedButtonId = @"testId";
+ NSString* expectedTitle = @"test";
+ XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
+ XCTAssertTrue([button.title isEqualToString:expectedTitle]);
+ XCTAssertTrue(button.enabled);
+}
+
+-(void)testRightButtonsWithTitle_withStyle {
+ NSNumber* inputColor = @(0xFFFF0000);
+
+ self.options.topBar.rightButtons = @[@{@"id": @"testId", @"text": @"test", @"enabled": @false, @"buttonColor": inputColor, @"buttonFontSize": @22, @"buttonFontWeight": @"800"}];
+ self.uut = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[RNNComponentPresenter new] options:self.options defaultOptions:nil];
+ RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:_creator options:nil defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:@[self.uut]];
+
+ RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.rightBarButtonItems objectAtIndex:0];
+ NSString* expectedButtonId = @"testId";
+ NSString* expectedTitle = @"test";
+ XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
+ XCTAssertTrue([button.title isEqualToString:expectedTitle]);
+ XCTAssertFalse(button.enabled);
+
+ //TODO: Determine how to tests buttonColor,buttonFontSize and buttonFontWeight?
+}
+
+-(void)testLeftButtonsWithTitle_withoutStyle {
+ self.options.topBar.leftButtons = @[@{@"id": @"testId", @"text": @"test"}];
+ self.uut = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[RNNComponentPresenter new] options:self.options defaultOptions:nil];
+ RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:_creator options:nil defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:@[self.uut]];
+
+ RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.leftBarButtonItems objectAtIndex:0];
+ NSString* expectedButtonId = @"testId";
+ NSString* expectedTitle = @"test";
+ XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
+ XCTAssertTrue([button.title isEqualToString:expectedTitle]);
+ XCTAssertTrue(button.enabled);
+}
+
+-(void)testLeftButtonsWithTitle_withStyle {
+ NSNumber* inputColor = @(0xFFFF0000);
+
+ self.options.topBar.leftButtons = @[@{@"id": @"testId", @"text": @"test", @"enabled": @false, @"buttonColor": inputColor, @"buttonFontSize": @22, @"buttonFontWeight": @"800"}];
+ self.uut = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[RNNComponentPresenter new] options:self.options defaultOptions:nil];
+ RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:_creator options:nil defaultOptions:nil presenter:nil eventEmitter:nil childViewControllers:@[self.uut]];
+
+ RNNUIBarButtonItem* button = (RNNUIBarButtonItem*)[nav.topViewController.navigationItem.leftBarButtonItems objectAtIndex:0];
+ NSString* expectedButtonId = @"testId";
+ NSString* expectedTitle = @"test";
+ XCTAssertTrue([button.buttonId isEqualToString:expectedButtonId]);
+ XCTAssertTrue([button.title isEqualToString:expectedTitle]);
+ XCTAssertFalse(button.enabled);
+
+ //TODO: Determine how to tests buttonColor,buttonFontSize and buttonFontWeight?
+}
+
+-(void)testTopBarNoBorderOn {
+ NSNumber* topBarNoBorderInput = @(1);
+ self.options.topBar.noBorder = [[Bool alloc] initWithValue:topBarNoBorderInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ XCTAssertNotNil(self.uut.navigationController.navigationBar.shadowImage);
+}
+
+-(void)testTopBarNoBorderOff {
+ NSNumber* topBarNoBorderInput = @(0);
+ self.options.topBar.noBorder = [[Bool alloc] initWithValue:topBarNoBorderInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ XCTAssertNil(self.uut.navigationController.navigationBar.shadowImage);
+}
+
+-(void)testStatusBarBlurOn {
+ NSNumber* statusBarBlurInput = @(1);
+ self.options.statusBar.blur = [[Bool alloc] initWithValue:statusBarBlurInput];
+ [self.uut viewWillAppear:false];
+ XCTAssertNotNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
+}
+
+-(void)testStatusBarBlurOff {
+ NSNumber* statusBarBlurInput = @(0);
+ self.options.statusBar.blur = [[Bool alloc] initWithValue:statusBarBlurInput];
+ [self.uut viewWillAppear:false];
+ XCTAssertNil([self.uut.view viewWithTag:BLUR_STATUS_TAG]);
+}
+
+- (void)testTabBarHidden_default {
+ [self.uut viewWillAppear:false];
+
+ XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
+}
+
+- (void)testTabBarHidden_false {
+ self.options.bottomTabs.visible = [[Bool alloc] initWithValue:@(1)];
+ [self.uut viewWillAppear:false];
+
+ XCTAssertFalse([self.uut hidesBottomBarWhenPushed]);
+}
+
+-(void)testTopBarBlur_default {
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
+}
+
+-(void)testTopBarBlur_false {
+ NSNumber* topBarBlurInput = @(0);
+ self.options.topBar.background.blur = [[Bool alloc] initWithValue:topBarBlurInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ XCTAssertNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
+}
+
+-(void)testTopBarBlur_true {
+ NSNumber* topBarBlurInput = @(1);
+ self.options.topBar.background.blur = [[Bool alloc] initWithValue:topBarBlurInput];
+ __unused RNNStackController* nav = [self createNavigationController];
+ [self.uut viewWillAppear:false];
+ XCTAssertNotNil([self.uut.navigationController.navigationBar viewWithTag:BLUR_TOPBAR_TAG]);
+}
+
+-(void)testBackgroundImage {
+ Image* backgroundImage = [[Image alloc] initWithValue:[[UIImage alloc] init]];
+ self.options.backgroundImage = backgroundImage;
+ [self.uut viewWillAppear:false];
+
+ XCTAssertTrue([[(UIImageView*)self.uut.view.subviews[0] image] isEqual:backgroundImage.get]);
+}
+
+- (void)testMergeOptionsShouldCallPresenterMergeOptions {
+ RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
+ [[(id) self.uut.presenter expect] mergeOptions:newOptions resolvedOptions:self.uut.options];
+ [self.uut mergeOptions:newOptions];
+ [(id)self.uut.presenter verify];
+}
+
+- (void)testOverrideOptions {
+ RNNNavigationOptions* newOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
+ newOptions.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
+
+ [self.uut overrideOptions:newOptions];
+ XCTAssertEqual([UIColor redColor], self.uut.options.topBar.background.color.get);
+}
+
+#pragma mark BottomTabs
+
+
+- (RNNStackController *)createNavigationController {
+ RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[[RNNStackPresenter alloc] init] eventEmitter:nil childViewControllers:@[self.uut]];
+
+ return nav;
+}
+
+@end
diff --git a/playground/ios/Podfile b/playground/ios/Podfile
index 18b088d6c2d..c148453155b 100644
--- a/playground/ios/Podfile
+++ b/playground/ios/Podfile
@@ -49,3 +49,8 @@ target 'NavigationTests' do
pod 'OCMock'
end
+target 'NavigationIOS12Tests' do
+ all_pods
+ pod 'OCMock'
+end
+
diff --git a/playground/ios/Podfile.lock b/playground/ios/Podfile.lock
index 0b64c31696b..0635fd80845 100644
--- a/playground/ios/Podfile.lock
+++ b/playground/ios/Podfile.lock
@@ -220,7 +220,7 @@ PODS:
- ReactCommon/jscallinvoker (= 0.61.4)
- ReactNativeKeyboardTrackingView (5.6.1):
- React
- - ReactNativeNavigation (4.0.4):
+ - ReactNativeNavigation (4.0.6):
- React
- Yoga (1.14.0)
@@ -346,9 +346,9 @@ SPEC CHECKSUMS:
React-RCTVibration: 0f76400ee3cec6edb9c125da49fed279340d145a
ReactCommon: a6a294e7028ed67b926d29551aa9394fd989c24c
ReactNativeKeyboardTrackingView: a240a6a0dba852bb107109a7ec7e98b884055977
- ReactNativeNavigation: bf2951e30fb873b3ed1e736419c38ed1efe0f6c2
+ ReactNativeNavigation: a04159cfe472aa4d9dd48d1185b4a2539b9dbbe2
Yoga: ba3d99dbee6c15ea6bbe3783d1f0cb1ffb79af0f
-PODFILE CHECKSUM: 8a6eee15d75935b9144e5228ce8fa2a5b98079e7
+PODFILE CHECKSUM: 781f49751a12b13af3e83d5dfc4b122aa5770543
COCOAPODS: 1.7.1
diff --git a/playground/ios/playground.xcodeproj/project.pbxproj b/playground/ios/playground.xcodeproj/project.pbxproj
index bf24c2ebbb0..3db837c78ce 100644
--- a/playground/ios/playground.xcodeproj/project.pbxproj
+++ b/playground/ios/playground.xcodeproj/project.pbxproj
@@ -13,6 +13,9 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
501C86B9239FE9C400E0B631 /* UIImage+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 501C86B8239FE9C400E0B631 /* UIImage+Utils.m */; };
50451D35204451A900695F00 /* RNNCustomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50451D34204451A800695F00 /* RNNCustomViewController.m */; };
+ 50996C6823AA477400008F89 /* RNNRootViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 50996C6723AA477400008F89 /* RNNRootViewControllerTest.m */; };
+ 50996C6923AA487800008F89 /* RNNTestRootViewCreator.m in Sources */ = {isa = PBXBuildFile; fileRef = E58D263D2385888C003F36BA /* RNNTestRootViewCreator.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 */; };
E58D26462385888C003F36BA /* UIViewController+LayoutProtocolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E58D26252385888B003F36BA /* UIViewController+LayoutProtocolTest.m */; };
@@ -47,6 +50,13 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
+ 50996C6223AA46DD00008F89 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
+ remoteInfo = playground;
+ };
E58D2620238587F4003F36BA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@@ -66,16 +76,22 @@
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
4259AF43A23D928FE78B4A3A /* Pods-NavigationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NavigationTests.debug.xcconfig"; path = "Target Support Files/Pods-NavigationTests/Pods-NavigationTests.debug.xcconfig"; sourceTree = ""; };
4A3340545EAAF11C1F146864 /* Pods_playground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_playground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4AE37ACF6BFBAB211EE8E7E9 /* Pods-NavigationIOS12Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NavigationIOS12Tests.release.xcconfig"; path = "Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests.release.xcconfig"; sourceTree = ""; };
501C86B7239FE9C400E0B631 /* UIImage+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+Utils.h"; sourceTree = ""; };
501C86B8239FE9C400E0B631 /* UIImage+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Utils.m"; sourceTree = ""; };
50364D69238E7ECC000E62A2 /* Pods_playground.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_playground.framework; sourceTree = BUILT_PRODUCTS_DIR; };
50364D6B238E7F0A000E62A2 /* ReactNativeNavigation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ReactNativeNavigation.framework; sourceTree = BUILT_PRODUCTS_DIR; };
50451D33204451A800695F00 /* RNNCustomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNNCustomViewController.h; path = ../../../lib/ios/RNNCustomViewController.h; sourceTree = ""; };
50451D34204451A800695F00 /* RNNCustomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNNCustomViewController.m; path = ../../../lib/ios/RNNCustomViewController.m; sourceTree = ""; };
+ 50996C5D23AA46DD00008F89 /* NavigationIOS12Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NavigationIOS12Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 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 = ""; };
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 = ""; };
+ C9E7FB91365E7BEF959ADB5F /* Pods-NavigationIOS12Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NavigationIOS12Tests.debug.xcconfig"; path = "Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests.debug.xcconfig"; sourceTree = ""; };
D95A99C17C65D674BA9DF26B /* Pods-NavigationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NavigationTests.release.xcconfig"; path = "Target Support Files/Pods-NavigationTests/Pods-NavigationTests.release.xcconfig"; sourceTree = ""; };
+ DEE0B5D45FD34FBABC6586CF /* Pods_NavigationIOS12Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NavigationIOS12Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E504607F227748EA00212BD8 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
E58D261B238587F4003F36BA /* NavigationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NavigationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
E58D261F238587F4003F36BA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
@@ -122,6 +138,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 50996C5A23AA46DD00008F89 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 67C681D42B662A53F29C19DA /* Pods_NavigationIOS12Tests.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
E58D2618238587F4003F36BA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -155,10 +179,21 @@
7F8E255E2E08F6ECE7DF6FE3 /* Pods-playground.release.xcconfig */,
4259AF43A23D928FE78B4A3A /* Pods-NavigationTests.debug.xcconfig */,
D95A99C17C65D674BA9DF26B /* Pods-NavigationTests.release.xcconfig */,
+ C9E7FB91365E7BEF959ADB5F /* Pods-NavigationIOS12Tests.debug.xcconfig */,
+ 4AE37ACF6BFBAB211EE8E7E9 /* Pods-NavigationIOS12Tests.release.xcconfig */,
);
path = Pods;
sourceTree = "";
};
+ 50996C5E23AA46DD00008F89 /* NavigationIOS12Tests */ = {
+ isa = PBXGroup;
+ children = (
+ 50996C6723AA477400008F89 /* RNNRootViewControllerTest.m */,
+ 50996C6123AA46DD00008F89 /* Info.plist */,
+ );
+ path = NavigationIOS12Tests;
+ sourceTree = "";
+ };
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
@@ -172,6 +207,7 @@
13B07FAE1A68108700A75B9A /* playground */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
E58D261C238587F4003F36BA /* NavigationTests */,
+ 50996C5E23AA46DD00008F89 /* NavigationIOS12Tests */,
83CBBA001A601CBA00E9B192 /* Products */,
E504607E227748E900212BD8 /* Frameworks */,
4620213833CA57C55B227B23 /* Pods */,
@@ -186,6 +222,7 @@
children = (
13B07F961A680F5B00A75B9A /* playground.app */,
E58D261B238587F4003F36BA /* NavigationTests.xctest */,
+ 50996C5D23AA46DD00008F89 /* NavigationIOS12Tests.xctest */,
);
name = Products;
sourceTree = "";
@@ -198,6 +235,7 @@
E504607F227748EA00212BD8 /* JavaScriptCore.framework */,
4A3340545EAAF11C1F146864 /* Pods_playground.framework */,
84E32151E3A71C2B7328BCB4 /* Pods_NavigationTests.framework */,
+ DEE0B5D45FD34FBABC6586CF /* Pods_NavigationIOS12Tests.framework */,
);
name = Frameworks;
sourceTree = "";
@@ -281,6 +319,26 @@
productReference = 13B07F961A680F5B00A75B9A /* playground.app */;
productType = "com.apple.product-type.application";
};
+ 50996C5C23AA46DD00008F89 /* NavigationIOS12Tests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 50996C6623AA46DD00008F89 /* Build configuration list for PBXNativeTarget "NavigationIOS12Tests" */;
+ buildPhases = (
+ 0F3F01851F0684D870017CA2 /* [CP] Check Pods Manifest.lock */,
+ 50996C5923AA46DD00008F89 /* Sources */,
+ 50996C5A23AA46DD00008F89 /* Frameworks */,
+ 50996C5B23AA46DD00008F89 /* Resources */,
+ CAB9D527AC9F72232C0702DB /* [CP] Embed Pods Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 50996C6323AA46DD00008F89 /* PBXTargetDependency */,
+ );
+ name = NavigationIOS12Tests;
+ productName = NavigationIOS12Tests;
+ productReference = 50996C5D23AA46DD00008F89 /* NavigationIOS12Tests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
E58D261A238587F4003F36BA /* NavigationTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = E58D2624238587F4003F36BA /* Build configuration list for PBXNativeTarget "NavigationTests" */;
@@ -307,12 +365,17 @@
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
+ DefaultBuildSystemTypeForWorkspace = Original;
LastUpgradeCheck = 1120;
ORGANIZATIONNAME = Wix;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
ProvisioningStyle = Manual;
};
+ 50996C5C23AA46DD00008F89 = {
+ CreatedOnToolsVersion = 11.2.1;
+ ProvisioningStyle = Automatic;
+ };
E58D261A238587F4003F36BA = {
CreatedOnToolsVersion = 11.2.1;
DevelopmentTeam = S3GLW74Y8N;
@@ -336,6 +399,7 @@
targets = (
13B07F861A680F5B00A75B9A /* playground */,
E58D261A238587F4003F36BA /* NavigationTests */,
+ 50996C5C23AA46DD00008F89 /* NavigationIOS12Tests */,
);
};
/* End PBXProject section */
@@ -350,6 +414,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 50996C5B23AA46DD00008F89 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
E58D2619238587F4003F36BA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -374,6 +445,28 @@
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh ./index.js\n";
};
+ 0F3F01851F0684D870017CA2 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-NavigationIOS12Tests-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
7019F906475029978A0A826C /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -526,6 +619,72 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
+ CAB9D527AC9F72232C0702DB /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-frameworks.sh",
+ "${BUILT_PRODUCTS_DIR}/DoubleConversion/DoubleConversion.framework",
+ "${BUILT_PRODUCTS_DIR}/FBReactNativeSpec/FBReactNativeSpec.framework",
+ "${BUILT_PRODUCTS_DIR}/Folly/folly.framework",
+ "${BUILT_PRODUCTS_DIR}/RCTTypeSafety/RCTTypeSafety.framework",
+ "${BUILT_PRODUCTS_DIR}/React-Core/React.framework",
+ "${BUILT_PRODUCTS_DIR}/React-CoreModules/CoreModules.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTActionSheet/RCTActionSheet.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTAnimation/RCTAnimation.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTBlob/RCTBlob.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTImage/RCTImage.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTLinking/RCTLinking.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTNetwork/RCTNetwork.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTSettings/RCTSettings.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTText/RCTText.framework",
+ "${BUILT_PRODUCTS_DIR}/React-RCTVibration/RCTVibration.framework",
+ "${BUILT_PRODUCTS_DIR}/React-cxxreact/cxxreact.framework",
+ "${BUILT_PRODUCTS_DIR}/React-jsi/jsi.framework",
+ "${BUILT_PRODUCTS_DIR}/React-jsiexecutor/jsireact.framework",
+ "${BUILT_PRODUCTS_DIR}/React-jsinspector/jsinspector.framework",
+ "${BUILT_PRODUCTS_DIR}/ReactCommon/ReactCommon.framework",
+ "${BUILT_PRODUCTS_DIR}/ReactNativeKeyboardTrackingView/ReactNativeKeyboardTrackingView.framework",
+ "${BUILT_PRODUCTS_DIR}/ReactNativeNavigation/ReactNativeNavigation.framework",
+ "${BUILT_PRODUCTS_DIR}/Yoga/yoga.framework",
+ "${BUILT_PRODUCTS_DIR}/glog/glog.framework",
+ "${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DoubleConversion.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBReactNativeSpec.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/folly.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTTypeSafety.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/React.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoreModules.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTActionSheet.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTAnimation.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTBlob.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTImage.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTLinking.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTNetwork.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTSettings.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTText.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RCTVibration.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/cxxreact.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsi.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsireact.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/jsinspector.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactCommon.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactNativeKeyboardTrackingView.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReactNativeNavigation.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/yoga.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OCMock.framework",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
D80DD80E880A67F5575078C4 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -561,6 +720,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 50996C5923AA46DD00008F89 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 50996C6923AA487800008F89 /* RNNTestRootViewCreator.m in Sources */,
+ 50996C6823AA477400008F89 /* RNNRootViewControllerTest.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
E58D2617238587F4003F36BA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -599,6 +767,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
+ 50996C6323AA46DD00008F89 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 13B07F861A680F5B00A75B9A /* playground */;
+ targetProxy = 50996C6223AA46DD00008F89 /* PBXContainerItemProxy */;
+ };
E58D2621238587F4003F36BA /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 13B07F861A680F5B00A75B9A /* playground */;
@@ -663,6 +836,54 @@
};
name = Release;
};
+ 50996C6423AA46DD00008F89 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = C9E7FB91365E7BEF959ADB5F /* Pods-NavigationIOS12Tests.debug.xcconfig */;
+ buildSettings = {
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CODE_SIGN_STYLE = Automatic;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ INFOPLIST_FILE = NavigationIOS12Tests/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = rn.NavigationIOS12Tests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 50996C6523AA46DD00008F89 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 4AE37ACF6BFBAB211EE8E7E9 /* Pods-NavigationIOS12Tests.release.xcconfig */;
+ buildSettings = {
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CODE_SIGN_STYLE = Automatic;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ INFOPLIST_FILE = NavigationIOS12Tests/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = rn.NavigationIOS12Tests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -828,6 +1049,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
+ 50996C6623AA46DD00008F89 /* Build configuration list for PBXNativeTarget "NavigationIOS12Tests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 50996C6423AA46DD00008F89 /* Debug */,
+ 50996C6523AA46DD00008F89 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "playground" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/playground/ios/playground.xcodeproj/xcshareddata/xcschemes/playgroundIOS12.xcscheme b/playground/ios/playground.xcodeproj/xcshareddata/xcschemes/playgroundIOS12.xcscheme
new file mode 100644
index 00000000000..8fd7bb6ddcd
--- /dev/null
+++ b/playground/ios/playground.xcodeproj/xcshareddata/xcschemes/playgroundIOS12.xcscheme
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/test-unit.js b/scripts/test-unit.js
index f2ff0181a09..f470ffd201d 100644
--- a/scripts/test-unit.js
+++ b/scripts/test-unit.js
@@ -23,32 +23,36 @@ function runAndroidUnitTests() {
}
function runIosUnitTests() {
- const conf = release ? `Release` : `Debug`;
-
exec.execSync('npm run build');
exec.execSync('npm run pod-install');
+ testTarget('playground', 'iPhone 11');
+ testTarget('playgroundIOS12', 'iPhone X', '12.2');
+}
+
+function testTarget(scheme, device, OS = 'latest') {
+ const conf = release ? `Release` : `Debug`;
exec.execSync(`cd ./playground/ios &&
- RCT_NO_LAUNCH_PACKAGER=true
- xcodebuild build build-for-testing
- -scheme "playground"
- -workspace playground.xcworkspace
- -sdk iphonesimulator
- -configuration ${conf}
- -derivedDataPath ./DerivedData/playground
- -quiet
- -UseModernBuildSystem=NO
- ONLY_ACTIVE_ARCH=YES`);
+ RCT_NO_LAUNCH_PACKAGER=true
+ xcodebuild build build-for-testing
+ -scheme "${scheme}"
+ -workspace playground.xcworkspace
+ -sdk iphonesimulator
+ -configuration ${conf}
+ -derivedDataPath ./DerivedData/playground
+ -quiet
+ -UseModernBuildSystem=NO
+ ONLY_ACTIVE_ARCH=YES`);
exec.execSync(`cd ./playground/ios &&
- RCT_NO_LAUNCH_PACKAGER=true
- xcodebuild test-without-building
- -scheme "playground"
- -workspace playground.xcworkspace
- -sdk iphonesimulator
- -configuration ${conf}
- -destination 'platform=iOS Simulator,name=iPhone 11'
- -derivedDataPath ./DerivedData/playground
- ONLY_ACTIVE_ARCH=YES`);
+ RCT_NO_LAUNCH_PACKAGER=true
+ xcodebuild test-without-building
+ -scheme "${scheme}"
+ -workspace playground.xcworkspace
+ -sdk iphonesimulator
+ -configuration ${conf}
+ -destination 'platform=iOS Simulator,name=${device},OS=${OS}'
+ -derivedDataPath ./DerivedData/playground
+ ONLY_ACTIVE_ARCH=YES`);
}
run();