Skip to content

Commit 8f88dac

Browse files
committed
Make above-content mode the new default
1 parent 851a8fb commit 8f88dac

File tree

8 files changed

+21232
-23522
lines changed

8 files changed

+21232
-23522
lines changed

e2e/SideMenu.test.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ import TestIDs from '../playground/src/testIDs';
33

44
const {elementByLabel, elementById, expectImagesToBeEqual} = Utils;
55

6-
describe.each([ 'aboveContent', 'pushContent' ])('SideMenu', (openMode) => {
6+
describe('SideMenu', () => {
77
beforeEach(async () => {
88
await device.launchApp({newInstance : true});
99
await elementById(TestIDs.SIDE_MENU_BTN).tap();
10-
11-
if (openMode === 'aboveContent') {
12-
await elementById(TestIDs.TOGGLE_SIDE_MENU_OPEN_MODE_BTN).tap();
13-
}
1410
});
1511

16-
describe(`Open mode '${openMode}'`, () => {
12+
describe.each(['aboveContent', 'pushContent'])('Open mode %s', (openMode) => {
13+
beforeEach(async () => {
14+
if (openMode === 'pushContent') {
15+
await elementById(TestIDs.TOGGLE_SIDE_MENU_OPEN_MODE_BTN).tap();
16+
}
17+
});
18+
1719
it('close SideMenu and push to stack with static id', async () => {
1820
await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap();
1921
await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN).tap();
@@ -89,4 +91,17 @@ describe.each([ 'aboveContent', 'pushContent' ])('SideMenu', (openMode) => {
8991
expectImagesToBeEqual(actual, snapshottedImagePath);
9092
});
9193
});
94+
95+
it.e2e(':ios: should open above-content by default', async () => {
96+
await elementById(TestIDs.TOGGLE_SIDE_MENU_OPEN_MODE_BTN).tap(); // aboveContent --> pushContent
97+
await elementById(TestIDs.TOGGLE_SIDE_MENU_OPEN_MODE_BTN).tap(); // pushContent --> undefined
98+
await expect(elementByLabel('Open mode: undefined')).toBeVisible();
99+
100+
await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap();
101+
102+
const snapshottedImagePath = `./e2e/assets/side_menu.undefined.png`;
103+
const actual =
104+
await elementById('SideMenuContainer').takeScreenshot(`side_menu_undefined`);
105+
expectImagesToBeEqual(actual, snapshottedImagePath);
106+
});
92107
});

e2e/assets/side_menu.aboveContent.png

-5.94 KB
Loading

e2e/assets/side_menu.pushContent.png

-6.62 KB
Loading

e2e/assets/side_menu.undefined.png

143 KB
Loading

lib/ios/RNNSideMenuPresenter.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ - (void)applyOptions:(RNNNavigationOptions *)options {
5454
[self.sideMenuController.view
5555
setBackgroundColor:[withDefault.layout.backgroundColor withDefault:nil]];
5656

57-
MMDrawerOpenMode openModeLeft = MMDrawerOpenModePushContent; // Default value
57+
MMDrawerOpenMode openModeLeft = MMDrawerOpenModeAboveContent; // Default value
5858
if (withDefault.sideMenu.left.openMode.hasValue) {
5959
NSString *openModeString = withDefault.sideMenu.left.openMode.get;
6060
openModeLeft = MMDrawerOpenModeFromString(openModeString);
6161
}
6262
[self.sideMenuController side:MMDrawerSideLeft openMode:openModeLeft];
6363

64-
MMDrawerOpenMode openModeRight = MMDrawerOpenModePushContent; // Default value
64+
MMDrawerOpenMode openModeRight = MMDrawerOpenModeAboveContent; // Default value
6565
if (withDefault.sideMenu.right.openMode.hasValue) {
6666
NSString *openModeString = withDefault.sideMenu.right.openMode.get;
6767
openModeRight = MMDrawerOpenModeFromString(openModeString);

lib/ios/RNNSideMenuSideOptions.mm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ - (void)mergeOptions:(RNNSideMenuSideOptions *)options {
2929
self.openMode = options.openMode;
3030
}
3131

32-
/**
33-
Converts a string open mode to the equivalent MMDrawerOpenMode enum value
34-
*/
3532
MMDrawerOpenMode MMDrawerOpenModeFromString(NSString *openModeString) {
3633
if ([openModeString isEqualToString:@"aboveContent"]) {
3734
return MMDrawerOpenModeAboveContent;

0 commit comments

Comments
 (0)