Skip to content

Commit 2dd02ef

Browse files
committed
Revert "Support drawer menus opening as overlay instead of pushing content in ios (#7984)"
1 parent b4bf90d commit 2dd02ef

File tree

9 files changed

+139
-788
lines changed

9 files changed

+139
-788
lines changed

lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,6 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController *dra
127127

128128
@interface MMDrawerController : UIViewController
129129

130-
/**
131-
Enum defining how the drawer opens
132-
*/
133-
typedef NS_ENUM(NSInteger, MMDrawerOpenMode) {
134-
MMDrawerOpenModePushContent = 0, // Original behavior - pushes content aside
135-
MMDrawerOpenModeAboveContent = 1, // Overlay behavior - opens above content
136-
};
137-
138130
///---------------------------------------
139131
/// @name Accessing Drawer Container View Controller Properties
140132
///---------------------------------------
@@ -221,18 +213,6 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController *dra
221213
@property(nonatomic, assign) BOOL shouldStretchLeftDrawer;
222214
@property(nonatomic, assign) BOOL shouldStretchRightDrawer;
223215

224-
/**
225-
* Specifies how the drawer should open relative to the center content.
226-
*
227-
* Possible values:
228-
* - MMDrawerOpenModePushContent: The drawer will push the center content aside when opening (traditional behavior).
229-
* - MMDrawerOpenModeAboveContent: The drawer will open above the center content with a semi-transparent overlay.
230-
*
231-
* By default, this value is set to MMDrawerOpenModePushContent.
232-
*/
233-
@property(nonatomic, assign) MMDrawerOpenMode leftDrawerOpenMode;
234-
@property(nonatomic, assign) MMDrawerOpenMode rightDrawerOpenMode;
235-
236216
/**
237217
The current open side of the drawer.
238218
@@ -620,6 +600,4 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController *dra
620600
(BOOL (^)(MMDrawerController *drawerController, UIGestureRecognizer *gesture,
621601
UITouch *touch))gestureShouldRecognizeTouchBlock;
622602

623-
- (void)side:(MMDrawerSide)drawerSide openMode:(MMDrawerOpenMode)openMode;
624-
625603
@end

lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m

Lines changed: 138 additions & 604 deletions
Large diffs are not rendered by default.

lib/ios/RNNSideMenuPresenter.m

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#import "RNNSideMenuPresenter.h"
22
#import "RNNSideMenuController.h"
3-
#import "RNNSideMenuSideOptions.h"
43

54
@implementation RNNSideMenuPresenter
65

@@ -53,23 +52,6 @@ - (void)applyOptions:(RNNNavigationOptions *)options {
5352

5453
[self.sideMenuController.view
5554
setBackgroundColor:[withDefault.layout.backgroundColor withDefault:nil]];
56-
57-
if (withDefault.sideMenu.left.openMode.hasValue) {
58-
NSString *openModeString = withDefault.sideMenu.left.openMode.get;
59-
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
60-
[self.sideMenuController side:MMDrawerSideLeft openMode:openMode];
61-
} else {
62-
[self.sideMenuController side:MMDrawerSideLeft openMode:MMDrawerOpenModePushContent];
63-
}
64-
65-
if (withDefault.sideMenu.right.openMode.hasValue) {
66-
NSString *openModeString = withDefault.sideMenu.right.openMode.get;
67-
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
68-
[self.sideMenuController side:MMDrawerSideRight openMode:openMode];
69-
} else {
70-
[self.sideMenuController side:MMDrawerSideRight openMode:MMDrawerOpenModePushContent];
71-
}
72-
7355
}
7456

7557
- (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
@@ -130,18 +112,6 @@ - (void)mergeOptions:(RNNNavigationOptions *)options
130112
options.sideMenu.right.shouldStretchDrawer.get;
131113
}
132114

133-
if (options.sideMenu.left.openMode.hasValue) {
134-
NSString *openModeString = options.sideMenu.left.openMode.get;
135-
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
136-
[self.sideMenuController side:MMDrawerSideLeft openMode:openMode];
137-
}
138-
139-
if (options.sideMenu.right.openMode.hasValue) {
140-
NSString *openModeString = options.sideMenu.right.openMode.get;
141-
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
142-
[self.sideMenuController side:MMDrawerSideRight openMode:openMode];
143-
}
144-
145115
if (options.sideMenu.left.animationVelocity.hasValue) {
146116
self.sideMenuController.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
147117
}

lib/ios/RNNSideMenuSideOptions.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,5 @@
88
@property(nonatomic, strong) Double *width;
99
@property(nonatomic, strong) Bool *shouldStretchDrawer;
1010
@property(nonatomic, strong) Double *animationVelocity;
11-
@property (nonatomic, strong) Text *openMode;
1211

13-
/**
14-
* Converts a string open mode to the equivalent MMDrawerOpenMode enum value
15-
*/
16-
MMDrawerOpenMode MMDrawerOpenModeFromString(NSString *openModeString);
17-
1812
@end

lib/ios/RNNSideMenuSideOptions.m

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ - (instancetype)initWithDict:(NSDictionary *)dict {
1010
self.width = [DoubleParser parse:dict key:@"width"];
1111
self.shouldStretchDrawer = [BoolParser parse:dict key:@"shouldStretchDrawer"];
1212
self.animationVelocity = [DoubleParser parse:dict key:@"animationVelocity"];
13-
self.openMode = [TextParser parse:dict key:@"openMode"];
13+
1414
return self;
1515
}
1616

@@ -25,24 +25,6 @@ - (void)mergeOptions:(RNNSideMenuSideOptions *)options {
2525
self.shouldStretchDrawer = options.shouldStretchDrawer;
2626
if (options.animationVelocity.hasValue)
2727
self.animationVelocity = options.animationVelocity;
28-
if (options.openMode.hasValue)
29-
self.openMode = options.openMode;
30-
}
31-
32-
/**
33-
Converts a string open mode to the equivalent MMDrawerOpenMode enum value
34-
*/
35-
MMDrawerOpenMode MMDrawerOpenModeFromString(NSString *openModeString) {
36-
if (!openModeString) {
37-
return MMDrawerOpenModePushContent; // Default
38-
}
39-
40-
if ([openModeString isEqualToString:@"aboveContent"]) {
41-
return MMDrawerOpenModeAboveContent;
42-
} else {
43-
// Default or explicit "pushContent"
44-
return MMDrawerOpenModePushContent;
45-
}
4628
}
4729

4830
@end

lib/src/interfaces/Options.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,13 +1082,6 @@ export interface SideMenuSide {
10821082
* @default true
10831083
*/
10841084
shouldStretchDrawer?: boolean;
1085-
/**
1086-
* Configure the opening mode of the side menu
1087-
* #### (iOS specific)
1088-
* @default 'pushContent'
1089-
1090-
*/
1091-
openMode?: 'pushContent' | 'aboveContent';
10921085
}
10931086

10941087
export interface OptionsSideMenu {

playground/ios/NavigationTests/RNNSideMenuPresenterTest.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ - (void)testApplyOptionsShouldSetDefaultValues {
4747
[[self.boundViewController expect] side:MMDrawerSideRight enabled:YES];
4848
[[self.boundViewController expect] setShouldStretchLeftDrawer:YES];
4949
[[self.boundViewController expect] setShouldStretchRightDrawer:YES];
50-
[[self.boundViewController expect] side:MMDrawerSideLeft openMode:MMDrawerOpenModePushContent];
51-
[[self.boundViewController expect] side:MMDrawerSideRight openMode:MMDrawerOpenModePushContent];
5250
[[self.boundViewController expect] setAnimationVelocityLeft:840.0f];
5351
[[self.boundViewController expect] setAnimationVelocityRight:840.0f];
5452
[[self.boundViewController reject] side:MMDrawerSideLeft width:0];
@@ -65,17 +63,13 @@ - (void)testApplyOptionsShouldSetInitialValues {
6563
self.options.sideMenu.right.enabled = [[Bool alloc] initWithBOOL:NO];
6664
self.options.sideMenu.left.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
6765
self.options.sideMenu.right.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
68-
self.options.sideMenu.left.openMode = [[Text alloc] initWithValue:@"aboveContent"];
69-
self.options.sideMenu.right.openMode = [[Text alloc] initWithValue:@"aboveContent"];
7066
self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
7167
self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
7268

7369
[[self.boundViewController expect] side:MMDrawerSideLeft enabled:NO];
7470
[[self.boundViewController expect] side:MMDrawerSideRight enabled:NO];
7571
[[self.boundViewController expect] setShouldStretchLeftDrawer:NO];
7672
[[self.boundViewController expect] setShouldStretchRightDrawer:NO];
77-
[[self.boundViewController expect] side:MMDrawerSideLeft openMode:MMDrawerOpenModeAboveContent];
78-
[[self.boundViewController expect] side:MMDrawerSideRight openMode:MMDrawerOpenModeAboveContent];
7973
[[self.boundViewController expect] setAnimationVelocityLeft:100.0f];
8074
[[self.boundViewController expect] setAnimationVelocityRight:100.0f];
8175

playground/src/screens/SetRootScreen.tsx

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ const {
1717
SET_ROOT_WITH_TWO_CHILDREN_HIDES_BOTTOM_TABS_BTN,
1818
SET_ROOT_WITHOUT_STACK_HIDES_BOTTOM_TABS_BTN,
1919
SET_ROOT_WITH_BUTTONS,
20-
SET_ROOT_WITH_RIGHT_MENU,
21-
SET_ROOT_WITH_LEFT_MENU,
2220
ROUND_BUTTON,
2321
} = testIDs;
2422

@@ -88,16 +86,6 @@ export default class SetRootScreen extends React.Component<NavigationProps> {
8886
testID={SET_ROOT_WITH_BUTTONS}
8987
onPress={this.setRootWithButtons}
9088
/>
91-
<Button
92-
label="Set Root with left menu"
93-
testID={SET_ROOT_WITH_LEFT_MENU}
94-
onPress={this.setRootWithLeftMenu}
95-
/>
96-
<Button
97-
label="Set Root with right menu"
98-
testID={SET_ROOT_WITH_RIGHT_MENU}
99-
onPress={this.setRootWithRightMenu}
100-
/>
10189
</Root>
10290
);
10391
}
@@ -326,84 +314,4 @@ export default class SetRootScreen extends React.Component<NavigationProps> {
326314
},
327315
},
328316
});
329-
330-
setRootWithLeftMenu = () =>
331-
Navigation.setRoot({
332-
root: {
333-
sideMenu: {
334-
left: {
335-
component: {
336-
id: 'sideMenu',
337-
name: Screens.SideMenuLeft,
338-
},
339-
},
340-
center: {
341-
stack: {
342-
children: [
343-
{
344-
component: {
345-
name: Screens.SideMenuCenter,
346-
id: 'SideMenuCenter',
347-
options: {
348-
animations: {
349-
setRoot: {
350-
waitForRender: true,
351-
},
352-
},
353-
},
354-
},
355-
},
356-
],
357-
},
358-
},
359-
options: {
360-
sideMenu: {
361-
left: {
362-
openMode: 'aboveContent',
363-
},
364-
},
365-
},
366-
},
367-
},
368-
});
369-
370-
setRootWithRightMenu = () =>
371-
Navigation.setRoot({
372-
root: {
373-
sideMenu: {
374-
right: {
375-
component: {
376-
id: 'sideMenu',
377-
name: Screens.SideMenuRight,
378-
},
379-
},
380-
center: {
381-
stack: {
382-
children: [
383-
{
384-
component: {
385-
name: Screens.SideMenuCenter,
386-
id: 'SideMenuCenter',
387-
options: {
388-
animations: {
389-
setRoot: {
390-
waitForRender: true,
391-
},
392-
},
393-
},
394-
},
395-
},
396-
],
397-
},
398-
},
399-
options: {
400-
sideMenu: {
401-
right: {
402-
openMode: 'aboveContent',
403-
},
404-
},
405-
},
406-
},
407-
},
408-
});
409317
}

playground/src/testIDs.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ const testIDs = {
120120
'SET_ROOT_WITH_TWO_CHILDREN_HIDES_BOTTOM_TABS_BTN',
121121
SET_ROOT_HIDES_BOTTOM_TABS_BTN: 'SET_ROOT_HIDES_BOTTOM_TABS_BTN',
122122
SET_ROOT_WITH_BUTTONS: 'SET_ROOT_WITH_BUTTONS',
123-
SET_ROOT_WITH_RIGHT_MENU: 'SET_ROOT_WITH_RIGHT_MENU',
124-
SET_ROOT_WITH_LEFT_MENU: 'SET_ROOT_WITH_LEFT_MENU',
125123
ADD_BACK_HANDLER: 'ADD_BACK_HANDLER',
126124
REMOVE_BACK_HANDLER: 'REMOVE_BACK_HANDLER',
127125
OPEN_LEFT_SIDE_MENU_BTN: 'OPEN_LEFT_SIDE_MENU_BTN',

0 commit comments

Comments
 (0)