diff --git a/ios/RNNSideMenu/MMDrawerController/MMDrawerController.mm b/ios/RNNSideMenu/MMDrawerController/MMDrawerController.mm index 93632158b8..6c5f0eecaf 100644 --- a/ios/RNNSideMenu/MMDrawerController/MMDrawerController.mm +++ b/ios/RNNSideMenu/MMDrawerController/MMDrawerController.mm @@ -387,7 +387,12 @@ - (void)closeDrawerInOverlayMode:(UIViewController *)sideDrawerViewController [self.centerContainerView bringSubviewToFront:self.centerContentOverlay]; self.centerContentOverlay.alpha = 0.5; } - + + //Reset the centerContainerView frame if it deviated + if (self.centerContainerView.frame.origin.x == visibleSide == MMDrawerSideLeft ? _maximumLeftDrawerWidth : _maximumRightDrawerWidth) { + [self.centerContainerView setFrame:self.childControllerContainerView.bounds]; + } + CGFloat distance = ABS(currentFrame.origin.x - finalFrame.origin.x); NSTimeInterval duration = [self animationDurationForDistance:distance velocity:velocity]; diff --git a/playground/e2e/SideMenu.test.js b/playground/e2e/SideMenu.test.js index 99e447b410..d193ae3dbb 100644 --- a/playground/e2e/SideMenu.test.js +++ b/playground/e2e/SideMenu.test.js @@ -1,5 +1,6 @@ import Utils from './Utils'; import TestIDs from '../src/testIDs'; +import jestExpect from 'expect'; const {elementByLabel, elementById, expectImagesToBeEqual} = Utils; @@ -90,6 +91,17 @@ describe('SideMenu', () => { await elementById('SideMenuContainer').takeScreenshot(`side_menu_${openMode}`); expectImagesToBeEqual(actual, snapshottedImagePath); }); + + it.e2e(':ios: center container should reset to full width after push and close', async () => { + await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); + await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_AND_CLOSE_BTN).tap(); + await elementById(TestIDs.POP_BTN).tap(); + const containerAttrs = await elementById('SideMenuContainer').getAttributes(); + const containerWidth = containerAttrs.frame.width; + const centerAttrs = await elementById(TestIDs.SIDE_MENU_CENTER_SCREEN_CONTAINER).getAttributes(); + const centerWidth = centerAttrs.frame.width; + jestExpect(centerWidth).toBe(containerWidth); + }); }); it.e2e(':ios: should open above-content by default', async () => {