Pārlūkot izejas kodu

Collapse content on fling (#554)

Guy Carmeli 8 gadus atpakaļ
vecāks
revīzija
9d0b8199f0

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/screens/CollapsingSingleScreen.java Parādīt failu

@@ -67,6 +67,9 @@ public class CollapsingSingleScreen extends SingleScreen {
67 67
 
68 68
                     @Override
69 69
                     public void onFling(CollapseAmount amount) {
70
+                        if (screenParams.styleParams.drawScreenBelowTopBar) {
71
+                            ((CollapsingView) contentView).collapse(amount);
72
+                        }
70 73
                         topBar.collapse(amount);
71 74
                     }
72 75
                 },

+ 3
- 2
android/app/src/main/java/com/reactnativenavigation/views/CollapsingContentView.java Parādīt failu

@@ -8,6 +8,7 @@ import android.view.View;
8 8
 import com.reactnativenavigation.params.NavigationParams;
9 9
 import com.reactnativenavigation.views.collapsingToolbar.CollapseAmount;
10 10
 import com.reactnativenavigation.views.collapsingToolbar.CollapsingView;
11
+import com.reactnativenavigation.views.collapsingToolbar.CollapsingViewMeasurer;
11 12
 import com.reactnativenavigation.views.collapsingToolbar.OnScrollViewAddedListener;
12 13
 import com.reactnativenavigation.views.collapsingToolbar.ScrollListener;
13 14
 import com.reactnativenavigation.views.collapsingToolbar.ScrollViewDelegate;
@@ -65,12 +66,12 @@ public class CollapsingContentView extends ContentView implements CollapsingView
65 66
 
66 67
     @Override
67 68
     public float getFinalCollapseValue() {
68
-        return 0;
69
+        return ((CollapsingViewMeasurer) viewMeasurer).getFinalCollapseValue();
69 70
     }
70 71
 
71 72
     @Override
72 73
     public float getCurrentCollapseValue() {
73
-        return 0;
74
+        return getTranslationY();
74 75
     }
75 76
 
76 77
     @Override