Browse Source

Menu set style fix (#549)

* Fix drawer param conversion method

* Added side identifier

* Updated setStyle

* Removed presumptive eval

* Removed debug import

* Removed unneeded flag
b_d 8 years ago
parent
commit
5e1708beb7

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java View File

@@ -117,7 +117,7 @@ public class SideMenu extends DrawerLayout {
117 117
 
118 118
     private void setStyle(SideMenuParams params) {
119 119
         if (params.disableOpenGesture) {
120
-            setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
120
+            setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, params.side.gravity);
121 121
         }
122 122
     }
123 123
 }

+ 12
- 13
src/deprecated/platformSpecificDeprecated.android.js View File

@@ -172,24 +172,23 @@ function convertStyleParams(originalStyleObject) {
172 172
 
173 173
 function convertDrawerParamsToSideMenuParams(drawerParams) {
174 174
   const drawer = Object.assign({}, drawerParams);
175
-  if (!drawer.left || !drawer.left.screen) {
176
-    return null;
177
-  }
178 175
 
179 176
   let result = {
180 177
     left: {},
181 178
     right: {}
182 179
   };
183
-  result.disableOpenGesture = drawer.disableOpenGesture !== undefined;
184
-  result.left.screenId = drawer.left.screen;
185
-  addNavigatorParams(result.left);
186
-  result.left = adaptNavigationParams(result.left);
187
-  result.left.passProps = drawer.left.passProps;
188
-
189
-  result.right.screenId = drawer.right.screen;
190
-  addNavigatorParams(result.right);
191
-  result.right = adaptNavigationParams(result.right);
192
-  result.right.passProps = drawer.right.passProps;
180
+
181
+  Object.keys(result).forEach((key) => {
182
+    if (drawer[key] && drawer[key].screen) {
183
+      result[key].screenId = drawer[key].screen;
184
+      addNavigatorParams(result[key]);
185
+      result[key] = adaptNavigationParams(result[key]);
186
+      result[key].passProps = drawer[key].passProps;
187
+      result[key].disableOpenGesture = drawer.disableOpenGesture;
188
+    } else {
189
+      result[key] = null;
190
+    }
191
+  })
193 192
 
194 193
   return result;
195 194
 }