Browse Source

Merge branch 'master' into v2

Daniel Zlotin 8 years ago
parent
commit
d1fa0fd373

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

4
 import android.support.v4.view.GravityCompat;
4
 import android.support.v4.view.GravityCompat;
5
 import android.support.v4.widget.DrawerLayout;
5
 import android.support.v4.widget.DrawerLayout;
6
 import android.view.Gravity;
6
 import android.view.Gravity;
7
+import android.view.ViewGroup;
7
 import android.widget.RelativeLayout;
8
 import android.widget.RelativeLayout;
8
 
9
 
9
 import com.reactnativenavigation.params.SideMenuParams;
10
 import com.reactnativenavigation.params.SideMenuParams;
11
+import com.reactnativenavigation.screens.Screen;
10
 import com.reactnativenavigation.utils.ViewUtils;
12
 import com.reactnativenavigation.utils.ViewUtils;
11
 
13
 
12
 public class SideMenu extends DrawerLayout {
14
 public class SideMenu extends DrawerLayout {
71
         sideMenuView = new ContentView(getContext(), sideMenuParams.screenId, sideMenuParams.navigationParams);
73
         sideMenuView = new ContentView(getContext(), sideMenuParams.screenId, sideMenuParams.navigationParams);
72
         LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
74
         LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
73
         lp.gravity = Gravity.START;
75
         lp.gravity = Gravity.START;
76
+        setSideMenuWidth();
74
         addView(sideMenuView, lp);
77
         addView(sideMenuView, lp);
75
     }
78
     }
76
 
79
 
80
+    private void setSideMenuWidth() {
81
+        sideMenuView.setOnDisplayListener(new Screen.OnDisplayListener() {
82
+            @Override
83
+            public void onDisplay() {
84
+                ViewGroup.LayoutParams lp = sideMenuView.getLayoutParams();
85
+                lp.width = sideMenuView.getChildAt(0).getWidth();
86
+                sideMenuView.setLayoutParams(lp);
87
+            }
88
+        });
89
+    }
90
+
77
     private void setStyle(SideMenuParams params) {
91
     private void setStyle(SideMenuParams params) {
78
         if (params.disableOpenGesture) {
92
         if (params.disableOpenGesture) {
79
             setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
93
             setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

+ 1
- 0
example/package.json View File

3
   "version": "0.0.1",
3
   "version": "0.0.1",
4
   "private": true,
4
   "private": true,
5
   "scripts": {
5
   "scripts": {
6
+    "postinstall": "rm -rf node_modules/react-native-navigation/node_modules && rm -rf node_modules/react-native-navigation/example && rm -rf yarn.lock",
6
     "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp:8081 || true) && node node_modules/react-native/local-cli/cli.js start",
7
     "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp:8081 || true) && node node_modules/react-native/local-cli/cli.js start",
7
     "xcode": "open ios/example.xcodeproj",
8
     "xcode": "open ios/example.xcodeproj",
8
     "android": "cd android && ./gradlew installDebug"
9
     "android": "cd android && ./gradlew installDebug"