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

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

83
         leftSideMenuView = createSideMenu(leftMenuParams);
83
         leftSideMenuView = createSideMenu(leftMenuParams);
84
         rightSideMenuView = createSideMenu(rightMenuParams);
84
         rightSideMenuView = createSideMenu(rightMenuParams);
85
         setStyle(leftMenuParams);
85
         setStyle(leftMenuParams);
86
+        setStyle(rightMenuParams);
86
     }
87
     }
87
 
88
 
88
     private void createContentContainer() {
89
     private void createContentContainer() {
117
 
118
 
118
     private void setStyle(SideMenuParams params) {
119
     private void setStyle(SideMenuParams params) {
119
         if (params.disableOpenGesture) {
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
 import android.support.annotation.Nullable;
4
 import android.support.annotation.Nullable;
5
 import android.view.GestureDetector;
5
 import android.view.GestureDetector;
6
 import android.view.MotionEvent;
6
 import android.view.MotionEvent;
7
+import android.view.ViewConfiguration;
7
 import android.widget.ScrollView;
8
 import android.widget.ScrollView;
8
 
9
 
9
 import com.reactnativenavigation.NavigationApplication;
10
 import com.reactnativenavigation.NavigationApplication;
31
     private OnFlingListener flingListener;
32
     private OnFlingListener flingListener;
32
     private int scrollY = 0;
33
     private int scrollY = 0;
33
     private int totalCollapse = 0;
34
     private int totalCollapse = 0;
35
+    private final int scaledTouchSlop;
34
 
36
 
35
     public CollapseCalculator(final CollapsingView collapsingView, CollapseBehaviour collapseBehaviour) {
37
     public CollapseCalculator(final CollapsingView collapsingView, CollapseBehaviour collapseBehaviour) {
36
         this.view = collapsingView;
38
         this.view = collapsingView;
37
         this.collapseBehaviour = collapseBehaviour;
39
         this.collapseBehaviour = collapseBehaviour;
40
+        scaledTouchSlop = ViewConfiguration.get(NavigationApplication.instance).getScaledTouchSlop();
38
         setFlingDetector();
41
         setFlingDetector();
39
     }
42
     }
40
 
43
 
188
         totalCollapse += collapse;
191
         totalCollapse += collapse;
189
         previousCollapseY = y;
192
         previousCollapseY = y;
190
         previousTouchEvent = MotionEvent.obtain(event);
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
     private float calculateCollapse(float y) {
197
     private float calculateCollapse(float y) {

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

172
 
172
 
173
 function convertDrawerParamsToSideMenuParams(drawerParams) {
173
 function convertDrawerParamsToSideMenuParams(drawerParams) {
174
   const drawer = Object.assign({}, drawerParams);
174
   const drawer = Object.assign({}, drawerParams);
175
-  if (!drawer.left || !drawer.left.screen) {
176
-    return null;
177
-  }
178
 
175
 
179
   let result = {
176
   let result = {
180
     left: {},
177
     left: {},
181
     right: {}
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
   return result;
193
   return result;
195
 }
194
 }