Browse Source

Merge branch 'master' into v2

Daniel Zlotin 8 years ago
parent
commit
337066699b

+ 2
- 2
android/app/src/main/java/com/reactnativenavigation/screens/CollapsingSingleScreen.java View File

@@ -8,9 +8,9 @@ import com.reactnativenavigation.views.CollapsingContentView;
8 8
 import com.reactnativenavigation.views.LeftButtonOnClickListener;
9 9
 import com.reactnativenavigation.views.collapsingToolbar.CollapseAmount;
10 10
 import com.reactnativenavigation.views.collapsingToolbar.CollapseCalculator;
11
-import com.reactnativenavigation.views.collapsingToolbar.CollapsingViewMeasurer;
12 11
 import com.reactnativenavigation.views.collapsingToolbar.CollapsingTopBar;
13 12
 import com.reactnativenavigation.views.collapsingToolbar.CollapsingView;
13
+import com.reactnativenavigation.views.collapsingToolbar.CollapsingViewMeasurer;
14 14
 import com.reactnativenavigation.views.collapsingToolbar.OnScrollListener;
15 15
 import com.reactnativenavigation.views.collapsingToolbar.OnScrollViewAddedListener;
16 16
 import com.reactnativenavigation.views.collapsingToolbar.ScrollListener;
@@ -59,7 +59,7 @@ public class CollapsingSingleScreen extends SingleScreen {
59 59
                 new OnScrollListener() {
60 60
                     @Override
61 61
                     public void onScroll(CollapseAmount amount) {
62
-                        if (!screenParams.styleParams.titleBarHideOnScroll) {
62
+                        if (screenParams.styleParams.drawScreenBelowTopBar) {
63 63
                             ((CollapsingView) contentView).collapse(amount);
64 64
                         }
65 65
                         topBar.collapse(amount);

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

@@ -83,6 +83,7 @@ public class SideMenu extends DrawerLayout {
83 83
         leftSideMenuView = createSideMenu(leftMenuParams);
84 84
         rightSideMenuView = createSideMenu(rightMenuParams);
85 85
         setStyle(leftMenuParams);
86
+        setStyle(rightMenuParams);
86 87
     }
87 88
 
88 89
     private void createContentContainer() {
@@ -117,7 +118,7 @@ public class SideMenu extends DrawerLayout {
117 118
 
118 119
     private void setStyle(SideMenuParams params) {
119 120
         if (params.disableOpenGesture) {
120
-            setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
121
+            setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, params.side.gravity);
121 122
         }
122 123
     }
123 124
 }

+ 4
- 1
android/app/src/main/java/com/reactnativenavigation/views/collapsingToolbar/CollapseCalculator.java View File

@@ -4,6 +4,7 @@ import android.support.annotation.NonNull;
4 4
 import android.support.annotation.Nullable;
5 5
 import android.view.GestureDetector;
6 6
 import android.view.MotionEvent;
7
+import android.view.ViewConfiguration;
7 8
 import android.widget.ScrollView;
8 9
 
9 10
 import com.reactnativenavigation.NavigationApplication;
@@ -31,10 +32,12 @@ public class CollapseCalculator {
31 32
     private OnFlingListener flingListener;
32 33
     private int scrollY = 0;
33 34
     private int totalCollapse = 0;
35
+    private final int scaledTouchSlop;
34 36
 
35 37
     public CollapseCalculator(final CollapsingView collapsingView, CollapseBehaviour collapseBehaviour) {
36 38
         this.view = collapsingView;
37 39
         this.collapseBehaviour = collapseBehaviour;
40
+        scaledTouchSlop = ViewConfiguration.get(NavigationApplication.instance).getScaledTouchSlop();
38 41
         setFlingDetector();
39 42
     }
40 43
 
@@ -188,7 +191,7 @@ public class CollapseCalculator {
188 191
         totalCollapse += collapse;
189 192
         previousCollapseY = y;
190 193
         previousTouchEvent = MotionEvent.obtain(event);
191
-        return new CollapseAmount(collapse);
194
+        return Math.abs(totalCollapse) < scaledTouchSlop ? CollapseAmount.None : new CollapseAmount(collapse);
192 195
     }
193 196
 
194 197
     private float calculateCollapse(float y) {

+ 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
 }