Skip to content

Revert #7984 (sidemenu as overlay) temporarily #7989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,6 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController *dra

@interface MMDrawerController : UIViewController

/**
Enum defining how the drawer opens
*/
typedef NS_ENUM(NSInteger, MMDrawerOpenMode) {
MMDrawerOpenModePushContent = 0, // Original behavior - pushes content aside
MMDrawerOpenModeAboveContent = 1, // Overlay behavior - opens above content
};

///---------------------------------------
/// @name Accessing Drawer Container View Controller Properties
///---------------------------------------
Expand Down Expand Up @@ -221,18 +213,6 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController *dra
@property(nonatomic, assign) BOOL shouldStretchLeftDrawer;
@property(nonatomic, assign) BOOL shouldStretchRightDrawer;

/**
* Specifies how the drawer should open relative to the center content.
*
* Possible values:
* - MMDrawerOpenModePushContent: The drawer will push the center content aside when opening (traditional behavior).
* - MMDrawerOpenModeAboveContent: The drawer will open above the center content with a semi-transparent overlay.
*
* By default, this value is set to MMDrawerOpenModePushContent.
*/
@property(nonatomic, assign) MMDrawerOpenMode leftDrawerOpenMode;
@property(nonatomic, assign) MMDrawerOpenMode rightDrawerOpenMode;

/**
The current open side of the drawer.

Expand Down Expand Up @@ -620,6 +600,4 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController *dra
(BOOL (^)(MMDrawerController *drawerController, UIGestureRecognizer *gesture,
UITouch *touch))gestureShouldRecognizeTouchBlock;

- (void)side:(MMDrawerSide)drawerSide openMode:(MMDrawerOpenMode)openMode;

@end
742 changes: 138 additions & 604 deletions lib/ios/RNNSideMenu/MMDrawerController/MMDrawerController.m

Large diffs are not rendered by default.

30 changes: 0 additions & 30 deletions lib/ios/RNNSideMenuPresenter.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#import "RNNSideMenuPresenter.h"
#import "RNNSideMenuController.h"
#import "RNNSideMenuSideOptions.h"

@implementation RNNSideMenuPresenter

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

[self.sideMenuController.view
setBackgroundColor:[withDefault.layout.backgroundColor withDefault:nil]];

if (withDefault.sideMenu.left.openMode.hasValue) {
NSString *openModeString = withDefault.sideMenu.left.openMode.get;
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
[self.sideMenuController side:MMDrawerSideLeft openMode:openMode];
} else {
[self.sideMenuController side:MMDrawerSideLeft openMode:MMDrawerOpenModePushContent];
}

if (withDefault.sideMenu.right.openMode.hasValue) {
NSString *openModeString = withDefault.sideMenu.right.openMode.get;
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
[self.sideMenuController side:MMDrawerSideRight openMode:openMode];
} else {
[self.sideMenuController side:MMDrawerSideRight openMode:MMDrawerOpenModePushContent];
}

}

- (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
Expand Down Expand Up @@ -130,18 +112,6 @@ - (void)mergeOptions:(RNNNavigationOptions *)options
options.sideMenu.right.shouldStretchDrawer.get;
}

if (options.sideMenu.left.openMode.hasValue) {
NSString *openModeString = options.sideMenu.left.openMode.get;
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
[self.sideMenuController side:MMDrawerSideLeft openMode:openMode];
}

if (options.sideMenu.right.openMode.hasValue) {
NSString *openModeString = options.sideMenu.right.openMode.get;
MMDrawerOpenMode openMode = MMDrawerOpenModeFromString(openModeString);
[self.sideMenuController side:MMDrawerSideRight openMode:openMode];
}

if (options.sideMenu.left.animationVelocity.hasValue) {
self.sideMenuController.animationVelocityLeft = options.sideMenu.left.animationVelocity.get;
}
Expand Down
6 changes: 0 additions & 6 deletions lib/ios/RNNSideMenuSideOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,5 @@
@property(nonatomic, strong) Double *width;
@property(nonatomic, strong) Bool *shouldStretchDrawer;
@property(nonatomic, strong) Double *animationVelocity;
@property (nonatomic, strong) Text *openMode;

/**
* Converts a string open mode to the equivalent MMDrawerOpenMode enum value
*/
MMDrawerOpenMode MMDrawerOpenModeFromString(NSString *openModeString);

@end
20 changes: 1 addition & 19 deletions lib/ios/RNNSideMenuSideOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ - (instancetype)initWithDict:(NSDictionary *)dict {
self.width = [DoubleParser parse:dict key:@"width"];
self.shouldStretchDrawer = [BoolParser parse:dict key:@"shouldStretchDrawer"];
self.animationVelocity = [DoubleParser parse:dict key:@"animationVelocity"];
self.openMode = [TextParser parse:dict key:@"openMode"];

return self;
}

Expand All @@ -25,24 +25,6 @@ - (void)mergeOptions:(RNNSideMenuSideOptions *)options {
self.shouldStretchDrawer = options.shouldStretchDrawer;
if (options.animationVelocity.hasValue)
self.animationVelocity = options.animationVelocity;
if (options.openMode.hasValue)
self.openMode = options.openMode;
}

/**
Converts a string open mode to the equivalent MMDrawerOpenMode enum value
*/
MMDrawerOpenMode MMDrawerOpenModeFromString(NSString *openModeString) {
if (!openModeString) {
return MMDrawerOpenModePushContent; // Default
}

if ([openModeString isEqualToString:@"aboveContent"]) {
return MMDrawerOpenModeAboveContent;
} else {
// Default or explicit "pushContent"
return MMDrawerOpenModePushContent;
}
}

@end
7 changes: 0 additions & 7 deletions lib/src/interfaces/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1082,13 +1082,6 @@ export interface SideMenuSide {
* @default true
*/
shouldStretchDrawer?: boolean;
/**
* Configure the opening mode of the side menu
* #### (iOS specific)
* @default 'pushContent'

*/
openMode?: 'pushContent' | 'aboveContent';
}

export interface OptionsSideMenu {
Expand Down
6 changes: 0 additions & 6 deletions playground/ios/NavigationTests/RNNSideMenuPresenterTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ - (void)testApplyOptionsShouldSetDefaultValues {
[[self.boundViewController expect] side:MMDrawerSideRight enabled:YES];
[[self.boundViewController expect] setShouldStretchLeftDrawer:YES];
[[self.boundViewController expect] setShouldStretchRightDrawer:YES];
[[self.boundViewController expect] side:MMDrawerSideLeft openMode:MMDrawerOpenModePushContent];
[[self.boundViewController expect] side:MMDrawerSideRight openMode:MMDrawerOpenModePushContent];
[[self.boundViewController expect] setAnimationVelocityLeft:840.0f];
[[self.boundViewController expect] setAnimationVelocityRight:840.0f];
[[self.boundViewController reject] side:MMDrawerSideLeft width:0];
Expand All @@ -65,17 +63,13 @@ - (void)testApplyOptionsShouldSetInitialValues {
self.options.sideMenu.right.enabled = [[Bool alloc] initWithBOOL:NO];
self.options.sideMenu.left.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
self.options.sideMenu.right.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
self.options.sideMenu.left.openMode = [[Text alloc] initWithValue:@"aboveContent"];
self.options.sideMenu.right.openMode = [[Text alloc] initWithValue:@"aboveContent"];
self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];

[[self.boundViewController expect] side:MMDrawerSideLeft enabled:NO];
[[self.boundViewController expect] side:MMDrawerSideRight enabled:NO];
[[self.boundViewController expect] setShouldStretchLeftDrawer:NO];
[[self.boundViewController expect] setShouldStretchRightDrawer:NO];
[[self.boundViewController expect] side:MMDrawerSideLeft openMode:MMDrawerOpenModeAboveContent];
[[self.boundViewController expect] side:MMDrawerSideRight openMode:MMDrawerOpenModeAboveContent];
[[self.boundViewController expect] setAnimationVelocityLeft:100.0f];
[[self.boundViewController expect] setAnimationVelocityRight:100.0f];

Expand Down
92 changes: 0 additions & 92 deletions playground/src/screens/SetRootScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const {
SET_ROOT_WITH_TWO_CHILDREN_HIDES_BOTTOM_TABS_BTN,
SET_ROOT_WITHOUT_STACK_HIDES_BOTTOM_TABS_BTN,
SET_ROOT_WITH_BUTTONS,
SET_ROOT_WITH_RIGHT_MENU,
SET_ROOT_WITH_LEFT_MENU,
ROUND_BUTTON,
} = testIDs;

Expand Down Expand Up @@ -88,16 +86,6 @@ export default class SetRootScreen extends React.Component<NavigationProps> {
testID={SET_ROOT_WITH_BUTTONS}
onPress={this.setRootWithButtons}
/>
<Button
label="Set Root with left menu"
testID={SET_ROOT_WITH_LEFT_MENU}
onPress={this.setRootWithLeftMenu}
/>
<Button
label="Set Root with right menu"
testID={SET_ROOT_WITH_RIGHT_MENU}
onPress={this.setRootWithRightMenu}
/>
</Root>
);
}
Expand Down Expand Up @@ -326,84 +314,4 @@ export default class SetRootScreen extends React.Component<NavigationProps> {
},
},
});

setRootWithLeftMenu = () =>
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
id: 'sideMenu',
name: Screens.SideMenuLeft,
},
},
center: {
stack: {
children: [
{
component: {
name: Screens.SideMenuCenter,
id: 'SideMenuCenter',
options: {
animations: {
setRoot: {
waitForRender: true,
},
},
},
},
},
],
},
},
options: {
sideMenu: {
left: {
openMode: 'aboveContent',
},
},
},
},
},
});

setRootWithRightMenu = () =>
Navigation.setRoot({
root: {
sideMenu: {
right: {
component: {
id: 'sideMenu',
name: Screens.SideMenuRight,
},
},
center: {
stack: {
children: [
{
component: {
name: Screens.SideMenuCenter,
id: 'SideMenuCenter',
options: {
animations: {
setRoot: {
waitForRender: true,
},
},
},
},
},
],
},
},
options: {
sideMenu: {
right: {
openMode: 'aboveContent',
},
},
},
},
},
});
}
2 changes: 0 additions & 2 deletions playground/src/testIDs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ const testIDs = {
'SET_ROOT_WITH_TWO_CHILDREN_HIDES_BOTTOM_TABS_BTN',
SET_ROOT_HIDES_BOTTOM_TABS_BTN: 'SET_ROOT_HIDES_BOTTOM_TABS_BTN',
SET_ROOT_WITH_BUTTONS: 'SET_ROOT_WITH_BUTTONS',
SET_ROOT_WITH_RIGHT_MENU: 'SET_ROOT_WITH_RIGHT_MENU',
SET_ROOT_WITH_LEFT_MENU: 'SET_ROOT_WITH_LEFT_MENU',
ADD_BACK_HANDLER: 'ADD_BACK_HANDLER',
REMOVE_BACK_HANDLER: 'REMOVE_BACK_HANDLER',
OPEN_LEFT_SIDE_MENU_BTN: 'OPEN_LEFT_SIDE_MENU_BTN',
Expand Down