Skip to content

Commit

Permalink
Fix bottomTabs visibility (#6230)
Browse files Browse the repository at this point in the history
* Fix setting root with bottomTabs.visible false
* Fix bottomTabs invisible after hiding through mergeOptions

on iOS, setting root with invisible bottomTabs doesn't work out of the box. We had to change the implementation and load the bottomTabsController children after it has been loaded to the window's rootViewController.
  • Loading branch information
yogevbd authored May 26, 2020
1 parent 8ec7bcd commit 4e1ac71
Show file tree
Hide file tree
Showing 20 changed files with 219 additions and 53 deletions.
14 changes: 14 additions & 0 deletions e2e/SetRoot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@ describe('SetRoot', () => {
await elementById(TestIDs.SET_MULTIPLE_ROOTS_BTN).tap();
await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible();
});

it('set root hides bottomTabs', async () => {
await elementById(TestIDs.SET_ROOT_HIDES_BOTTOM_TABS_BTN).tap();
await expect(elementById(TestIDs.LAYOUTS_TAB)).toBeNotVisible();
await elementById(TestIDs.PUSH_BTN).tap();
await expect(elementById(TestIDs.LAYOUTS_TAB)).toBeVisible();
});

it('set root with stack hides bottomTabs', async () => {
await elementById(TestIDs.SET_ROOT_WITH_STACK_HIDES_BOTTOM_TABS_BTN).tap();
await expect(elementById(TestIDs.LAYOUTS_TAB)).toBeNotVisible();
await elementById(TestIDs.POP_BTN).tap();
await expect(elementById(TestIDs.LAYOUTS_TAB)).toBeVisible();
});
});
1 change: 1 addition & 0 deletions lib/ios/BottomTabsBasePresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ - (void)applyOptions:(RNNNavigationOptions *)options {
RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];

[bottomTabs setTabBarTestID:[withDefault.bottomTabs.testID getWithDefaultValue:nil]];
![withDefault.bottomTabs.visible getWithDefaultValue:YES] ?: [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible getWithDefaultValue:YES] animated:[withDefault.bottomTabs.animate getWithDefaultValue:NO]];

[bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
[self applyBackgroundColor:[withDefault.bottomTabs.backgroundColor getWithDefaultValue:nil] translucent:[withDefault.bottomTabs.translucent getWithDefaultValue:NO]];
Expand Down
5 changes: 3 additions & 2 deletions lib/ios/BottomTabsTogetherAttacher.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#import "BottomTabsTogetherAttacher.h"
#import "RNNBottomTabsController.h"

@implementation BottomTabsTogetherAttacher

- (void)attach:(UITabBarController *)bottomTabsController {
for (UIViewController* childViewController in bottomTabsController.childViewControllers) {
- (void)attach:(RNNBottomTabsController *)bottomTabsController {
for (UIViewController* childViewController in bottomTabsController.pendingChildViewControllers) {
[childViewController render];
}

Expand Down
2 changes: 2 additions & 0 deletions lib/ios/RNNBottomTabsController.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@

- (void)setSelectedIndexByComponentID:(NSString *)componentID;

@property (nonatomic, strong) NSArray* pendingChildViewControllers;

@end
27 changes: 25 additions & 2 deletions lib/ios/RNNBottomTabsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@interface RNNBottomTabsController ()
@property (nonatomic, strong) BottomTabPresenter* bottomTabPresenter;
@property (nonatomic, strong) RNNDotIndicatorPresenter* dotIndicatorPresenter;
@property (nonatomic) BOOL viewWillAppearOnce;
@end

@implementation RNNBottomTabsController {
Expand All @@ -25,13 +26,20 @@ - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
_bottomTabsAttacher = bottomTabsAttacher;
_bottomTabPresenter = bottomTabPresenter;
_dotIndicatorPresenter = dotIndicatorPresenter;
_pendingChildViewControllers = childViewControllers;
self = [super initWithLayoutInfo:layoutInfo creator:creator options:options defaultOptions:defaultOptions presenter:presenter eventEmitter:eventEmitter childViewControllers:childViewControllers];
if (@available(iOS 13.0, *)) {
self.tabBar.standardAppearance = [UITabBarAppearance new];
}
return self;
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
_viewWillAppearOnce = YES;
[self loadChildren:self.pendingChildViewControllers];
}

- (void)onChildAddToParent:(UIViewController *)child options:(RNNNavigationOptions *)options {
[_bottomTabPresenter applyOptionsOnWillMoveToParentViewController:options child:child];
}
Expand Down Expand Up @@ -73,11 +81,14 @@ - (CGFloat)getBottomTabsHeight {
}

- (void)setSelectedIndexByComponentID:(NSString *)componentID {
for (id child in self.childViewControllers) {
NSArray* children = self.pendingChildViewControllers ?: self.childViewControllers;
for (id child in children) {
UIViewController<RNNLayoutProtocol>* vc = child;

if ([vc conformsToProtocol:@protocol(RNNLayoutProtocol)] && [vc.layoutInfo.componentId isEqualToString:componentID]) {
[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
NSUInteger selectedIndex = [children indexOfObject:child];
[self setSelectedIndex:selectedIndex];
_currentTabIndex = selectedIndex;
}
}
}
Expand All @@ -87,6 +98,18 @@ - (void)setSelectedIndex:(NSUInteger)selectedIndex {
[super setSelectedIndex:selectedIndex];
}

- (UIViewController *)selectedViewController {
NSArray* children = self.pendingChildViewControllers ?: self.childViewControllers;
return children.count ? children[_currentTabIndex] : nil;
}

- (void)loadChildren:(NSArray *)children {
if (self.viewWillAppearOnce) {
[super loadChildren:children];
self.pendingChildViewControllers = nil;
}
}

#pragma mark UITabBarControllerDelegate

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
Expand Down
2 changes: 1 addition & 1 deletion lib/ios/RNNSplitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ - (void)setViewControllers:(NSArray<__kindof UIViewController *> *)viewControlle
}

- (UIViewController *)getCurrentChild {
return self.viewControllers[0];
return self.viewControllers[0];
}

# pragma mark - UIViewController overrides
Expand Down
3 changes: 3 additions & 0 deletions lib/ios/UIViewController+LayoutProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);

- (void)screenPopped;

- (void)loadChildren:(NSArray *)children;

@property (nonatomic, retain) RNNBasePresenter* presenter;
@property (nonatomic, retain) RNNLayoutInfo* layoutInfo;
@property (nonatomic, strong) RNNNavigationOptions* options;
Expand All @@ -50,5 +52,6 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void);
@property (nonatomic) id<RNNComponentViewCreator> creator;
@property (nonatomic) RNNReactViewReadyCompletionBlock reactViewReadyCallback;
@property (nonatomic) BOOL waitForRender;
@property (nonatomic) BOOL isChildViewControllersLoaded;

@end
20 changes: 16 additions & 4 deletions lib/ios/UIViewController+LayoutProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
eventEmitter:(RNNEventEmitter *)eventEmitter
childViewControllers:(NSArray *)childViewControllers {
self = [self init];

self.options = options;
self.defaultOptions = defaultOptions;
self.layoutInfo = layoutInfo;
Expand All @@ -21,9 +20,7 @@ - (instancetype)initWithLayoutInfo:(RNNLayoutInfo *)layoutInfo
self.presenter = presenter;
[self.presenter bindViewController:self];
self.extendedLayoutIncludesOpaqueBars = YES;
if ([self respondsToSelector:@selector(setViewControllers:)]) {
[self performSelector:@selector(setViewControllers:) withObject:childViewControllers];
}
[self loadChildren:childViewControllers];
[self.presenter applyOptionsOnInit:self.resolveOptions];

return self;
Expand Down Expand Up @@ -74,6 +71,13 @@ - (void)render {
[self.getCurrentChild render];
}

- (void)loadChildren:(NSArray *)children {
if (!self.isChildViewControllersLoaded && [self respondsToSelector:@selector(setViewControllers:)]) {
self.isChildViewControllersLoaded = YES;
[self performSelector:@selector(setViewControllers:) withObject:children];
}
}

- (void)readyForPresentation {
if (self.reactViewReadyCallback) {
self.reactViewReadyCallback();
Expand Down Expand Up @@ -212,6 +216,14 @@ - (void)setEventEmitter:(RNNEventEmitter *)eventEmitter {
objc_setAssociatedObject(self, @selector(eventEmitter), eventEmitter, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (BOOL)isChildViewControllersLoaded {
return [objc_getAssociatedObject(self, @selector(isChildViewControllersLoaded)) boolValue];
}

- (void)setIsChildViewControllersLoaded:(BOOL)isChildViewControllersLoaded {
objc_setAssociatedObject(self, @selector(isChildViewControllersLoaded), [NSNumber numberWithBool:isChildViewControllersLoaded], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

- (id<RNNComponentViewCreator>)creator {
return objc_getAssociatedObject(self, @selector(creator));
}
Expand Down
11 changes: 11 additions & 0 deletions playground/ios/NavigationIOS12Tests/RNNBottomTabsPresenterTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ - (void)testApplyOptions_shouldSetDefaultEmptyOptions {
[[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
[[self.boundViewController expect] setTabBarHideShadow:NO];
[[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
[[self.boundViewController expect] setTabBarVisible:YES animated:NO];
[self.uut applyOptions:emptyOptions];
[self.boundViewController verify];
}
Expand All @@ -50,6 +51,16 @@ - (void)testApplyOptions_shouldApplyOptions {
[self.boundViewController verify];
}

- (void)testApplyOptions_shouldRestoreHiddenTabBar {
RNNNavigationOptions *initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
initialOptions.bottomTabs.visible = [[Bool alloc] initWithValue:@(1)];

[[self.boundViewController expect] setTabBarVisible:YES animated:NO];

[self.uut applyOptions:initialOptions];
[self.boundViewController verify];
}

- (void)testApplyOptionsOnInit_alwaysShow_shouldNotCenterTabImages {
RNNNavigationOptions *initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
initialOptions.bottomTabs.titleDisplayMode = [[Text alloc] initWithValue:@"alwaysShow"];
Expand Down
15 changes: 8 additions & 7 deletions playground/ios/NavigationIOS12Tests/RNNRootViewControllerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ -(void)testTabBadge {
[self.uut setTabBarItem:item];
[controllers addObject:self.uut];
__unused RNNBottomTabsController* vc = [RNNBottomTabsController createWithChildren:controllers];
[vc viewWillAppear:NO];
[self.uut willMoveToParentViewController:vc];
XCTAssertTrue([self.uut.tabBarItem.badgeValue isEqualToString:tabBadgeInput]);

Expand Down Expand Up @@ -375,8 +376,8 @@ -(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];

__unused RNNBottomTabsController* vc = [RNNBottomTabsController createWithChildren:controllers];
[vc viewWillAppear:NO];
[self.uut viewWillAppear:false];

UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskPortrait;
Expand All @@ -387,8 +388,8 @@ -(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];

__unused RNNBottomTabsController* vc = [RNNBottomTabsController createWithChildren:controllers];
[vc viewWillAppear:NO];
[self.uut viewWillAppear:false];

UIInterfaceOrientationMask expectedOrientation = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape);
Expand All @@ -399,8 +400,8 @@ -(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];

__unused RNNBottomTabsController* vc = [RNNBottomTabsController createWithChildren:controllers];
[vc viewWillAppear:NO];
[self.uut viewWillAppear:false];

UIInterfaceOrientationMask expectedOrientation = UIInterfaceOrientationMaskAll;
Expand Down Expand Up @@ -560,7 +561,7 @@ - (void)testOverrideOptions {

- (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]];

[nav viewWillAppear:NO];
return nav;
}

Expand Down
35 changes: 13 additions & 22 deletions playground/ios/NavigationTests/BottomTabsControllerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ - (void)testInitWithLayoutInfo_shouldSetMultipleViewControllers {
UIViewController *vc1 = [[UIViewController alloc] init];
UIViewController *vc2 = [[UIViewController alloc] init];

RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNComponentPresenter alloc] init] eventEmitter:nil childViewControllers:@[vc1, vc2]];
RNNBottomTabsController *uut = [RNNBottomTabsController createWithChildren:@[vc1, vc2]];
[uut viewWillAppear:YES];
XCTAssertTrue(uut.viewControllers.count == 2);
}

Expand All @@ -51,32 +52,19 @@ - (void)testInitWithLayoutInfo_shouldInitializeDependencies {
RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:@{}];
RNNBottomTabsPresenter *presenter = [[RNNBottomTabsPresenter alloc] init];
NSArray *childViewControllers = @[[UIViewController new]];

RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter eventEmitter:nil childViewControllers:childViewControllers];
XCTAssertTrue(uut.layoutInfo == layoutInfo);
XCTAssertTrue(uut.options == options);
XCTAssertTrue(uut.presenter == presenter);
XCTAssertTrue(uut.childViewControllers.count == childViewControllers.count);
}

- (void)testInitWithEventEmmiter_shouldInitializeDependencies {
RNNLayoutInfo *layoutInfo = [RNNLayoutInfo new];
RNNNavigationOptions *options = [[RNNNavigationOptions alloc] initWithDict:@{}];
RNNBottomTabsPresenter *presenter = [[RNNBottomTabsPresenter alloc] init];
RNNEventEmitter *eventEmmiter = [RNNEventEmitter new];

NSArray *childViewControllers = @[[UIViewController new]];

RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter eventEmitter:eventEmmiter childViewControllers:childViewControllers];
RNNEventEmitter *eventEmmiter = [RNNEventEmitter new];

RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter bottomTabPresenter:nil dotIndicatorPresenter:nil eventEmitter:eventEmmiter childViewControllers:childViewControllers bottomTabsAttacher:nil];
[uut viewWillAppear:YES];
XCTAssertTrue(uut.layoutInfo == layoutInfo);
XCTAssertTrue(uut.options == options);
XCTAssertTrue(uut.presenter == presenter);
XCTAssertTrue(uut.childViewControllers.count == childViewControllers.count);
XCTAssertTrue(uut.eventEmitter == eventEmmiter);
XCTAssertTrue(uut.eventEmitter == eventEmmiter);
}

- (void)testInitWithLayoutInfo_shouldSetDelegate {
RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNBasePresenter alloc] init] eventEmitter:nil childViewControllers:nil];
RNNBottomTabsController *uut = [RNNBottomTabsController createWithChildren:@[]];

XCTAssertTrue(uut.delegate == uut);
}
Expand Down Expand Up @@ -179,7 +167,9 @@ - (void)testSetSelectedIndexByComponentID_ShouldSetSelectedIndexWithCorrectIndex

RNNComponentViewController *vc = [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:nil presenter:nil options:nil defaultOptions:nil];

RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:nil defaultOptions:nil presenter:[RNNBottomTabsPresenter new] eventEmitter:nil childViewControllers:@[[UIViewController new], vc]];
RNNBottomTabsController *uut = [RNNBottomTabsController createWithChildren:@[[UIViewController new], vc]];
[uut viewWillAppear:YES];

[uut setSelectedIndexByComponentID:@"componentId"];
XCTAssertTrue(uut.selectedIndex == 1);
}
Expand All @@ -189,7 +179,8 @@ - (void)testSetSelectedIndex_ShouldSetSelectedIndexWithCurrentTabIndex {
options.bottomTabs.currentTabIndex = [[IntNumber alloc] initWithValue:@(1)];

RNNComponentViewController *vc = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:nil options:nil defaultOptions:nil];
RNNBottomTabsController *uut = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:nil presenter:[RNNBottomTabsPresenter new] eventEmitter:nil childViewControllers:@[[UIViewController new], vc]];
RNNBottomTabsController *uut = [RNNBottomTabsController createWithChildren:@[[UIViewController new], vc] options:options];
[uut viewWillAppear:YES];

XCTAssertTrue(uut.selectedIndex == 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ - (void)setUp {
self.dotIndicatorPresenter = [OCMockObject partialMockForObject:[[RNNDotIndicatorPresenter alloc] initWithDefaultOptions:nil]];
self.uut = [OCMockObject partialMockForObject:[BottomTabsPresenterCreator createWithDefaultOptions:nil]];
self.boundViewController = [OCMockObject partialMockForObject:[[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:nil defaultOptions:nil presenter:self.uut bottomTabPresenter:[BottomTabPresenterCreator createWithDefaultOptions:nil] dotIndicatorPresenter:self.dotIndicatorPresenter eventEmitter:nil childViewControllers:self.children bottomTabsAttacher:nil]];
[self.boundViewController viewWillAppear:YES];
[self.uut bindViewController:self.boundViewController];
self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
}
Expand All @@ -35,7 +36,8 @@ - (void)testApplyOptions_shouldSetDefaultEmptyOptions {
[[self.boundViewController expect] setTabBarTestID:nil];
[[(id)self.uut expect] applyBackgroundColor:nil translucent:NO];
[[self.boundViewController expect] setTabBarHideShadow:NO];
[[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
[[self.boundViewController expect] setTabBarVisible:YES animated:NO];
[[self.boundViewController expect] setTabBarStyle:UIBarStyleDefault];
[self.uut applyOptions:emptyOptions];
[self.boundViewController verify];
}
Expand All @@ -58,6 +60,16 @@ - (void)testApplyOptions_shouldApplyOptions {
[self.boundViewController verify];
}

- (void)testApplyOptions_shouldRestoreHiddenTabBar {
RNNNavigationOptions *initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
initialOptions.bottomTabs.visible = [[Bool alloc] initWithValue:@(1)];

[[self.boundViewController expect] setTabBarVisible:YES animated:NO];

[self.uut applyOptions:initialOptions];
[self.boundViewController verify];
}

- (void)testApplyOptionsOnInit_alwaysShow_shouldNotCenterTabImages {
RNNNavigationOptions *initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
initialOptions.bottomTabs.titleDisplayMode = [[Text alloc] initWithValue:@"alwaysShow"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@

+ (RNNBottomTabsController *)createWithChildren:(NSArray *)children;

+ (RNNBottomTabsController *)createWithChildren:(NSArray *)children options:(RNNNavigationOptions *)options;

@end
Loading

5 comments on commit 4e1ac71

@N3TC4T
Copy link
Contributor

@N3TC4T N3TC4T commented on 4e1ac71 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yogevbd

After this commit, hiding the bottomTabs or any other option change with static options for bottomTabs are not working anymore

 static options() {
        return {
            bottomTabs: { visible: false},
        };
    }

@ph1p
Copy link

@ph1p ph1p commented on 4e1ac71 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also discovered a problem :/
I created a bottom tab navigator with Stack Navigator children, because I want to move screens over the bottom tabs.

With these options, I can move it over the bottom tabs, but that only works on the initial bottom tab!
This works fine with v6.6.2.

  Navigation.push(componentId, {
    component: {
      name:'screen1',
      options: {
        bottomTabs: {
          visible: false,
          drawBehind: true,
        },
      },
    },
  });

root

Navigation.setRoot({
  root: {
    bottomTabs: {
      children: [
        {
          stack: {
            children: [
              {
                component: {
                  name: 'screen1',
                },
              },
            ],
          },
        },
        {
          // works, beacuse it's the initial tab
          stack: {
            children: [
              {
                component: {
                  name: 'screen2',
                },
              },
            ],
          },
        },
      ],
      options: {
        bottomTabs: {
          visible: true,
          drawBehind: true,
          currentTabIndex: 1,
          tabsAttachMode: 'onSwitchToTab',
        }
      },
    },
  },
});

@guyca
Copy link
Collaborator

@guyca guyca commented on 4e1ac71 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@N3TC4T We'll investigate first thing Sunday.
@ph1p I'm not sure I understood the bug - could you please open an issue with a reproduciton? We'll also look into it early next week.

Thanks both and sorry for the trouble.

@ph1p
Copy link

@ph1p ph1p commented on 4e1ac71 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guyca have opened an issue #6268

@guyca
Copy link
Collaborator

@guyca guyca commented on 4e1ac71 Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@N3TC4T We published 6.7.2 with a fix

Please sign in to comment.