Browse Source

Collapse content on fling (#554)

Guy Carmeli 8 years ago
parent
commit
9d0b8199f0

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

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

+ 3
- 2
android/app/src/main/java/com/reactnativenavigation/views/CollapsingContentView.java View File

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