diff --git a/e2e/SideMenu.test.js b/e2e/SideMenu.test.js index b2fd2c66dd4..30c096fa5fb 100644 --- a/e2e/SideMenu.test.js +++ b/e2e/SideMenu.test.js @@ -36,4 +36,10 @@ describe('SideMenu', () => { await elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN).tap(); await expect(elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN)).toBeNotVisible(); }); + + it('should rotate', async () => { + await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap(); + await device.setOrientation('landscape'); + await expect(elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN)).toBeVisible(); + }); }); diff --git a/lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m b/lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m index c0aa2501cc9..cc2dda85d6f 100755 --- a/lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m +++ b/lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m @@ -811,12 +811,12 @@ -(void)viewDidDisappear:(BOOL)animated{ #pragma mark Rotation --(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{ +-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; //If a rotation begins, we are going to cancel the current gesture and reset transform and anchor points so everything works correctly BOOL gestureInProgress = NO; - for(UIGestureRecognizer * gesture in self.view.gestureRecognizers){ - if(gesture.state == UIGestureRecognizerStateChanged){ + for(UIGestureRecognizer * gesture in self.view.gestureRecognizers) { + if(gesture.state == UIGestureRecognizerStateChanged) { [gesture setEnabled:NO]; [gesture setEnabled:YES]; gestureInProgress = YES; @@ -825,6 +825,7 @@ -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrien [self resetDrawerVisualStateForDrawerSide:self.openSide]; } } + if ([self needsManualForwardingOfRotationEvents]){ for(UIViewController * childViewController in self.childViewControllers){ [childViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; @@ -867,23 +868,14 @@ -(BOOL)shouldAutorotate{ return YES; } --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ +-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + if ([self needsManualForwardingOfRotationEvents]){ - for(UIViewController * childViewController in self.childViewControllers){ + for(UIViewController * childViewController in self.childViewControllers) { [childViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; } } - if (self.rightDrawerViewController != nil) { - for (UIView * subview in self.rightDrawerViewController.view.subviews) { - subview.frame = self.view.bounds; - } - } - if (self.leftDrawerViewController != nil) { - for (UIView * subview in self.leftDrawerViewController.view.subviews) { - subview.frame = self.view.bounds; - } - } } -(bool)hasPan diff --git a/playground/src/screens/SideMenuLeftScreen.js b/playground/src/screens/SideMenuLeftScreen.js index bb2399b17c9..898deed3cea 100644 --- a/playground/src/screens/SideMenuLeftScreen.js +++ b/playground/src/screens/SideMenuLeftScreen.js @@ -11,6 +11,13 @@ const { } = require('../testIDs'); class SideMenuLeftScreen extends React.Component { + static options() { + return { + layout: { + orientation: ['portrait', 'landscape'] + } + }; + } render() { return (