Browse Source

scroll content

Daniel Zlotin 8 years ago
parent
commit
493aad9621

+ 6
- 3
android/app/src/main/java/com/reactnativenavigation/views/ContentView.java View File

@@ -6,15 +6,18 @@ import android.os.Bundle;
6 6
 import com.facebook.react.ReactInstanceManager;
7 7
 import com.facebook.react.ReactRootView;
8 8
 
9
-public class ContentView extends ReactRootView {
9
+public class ContentView extends ReactRootView implements ScrollDirectionListener.OnChanged {
10
+
11
+    private final ScrollViewAttacher scrollViewAttacher;
10 12
 
11 13
     public ContentView(Context context, ReactInstanceManager reactInstanceManager, String moduleName, Bundle passProps) {
12 14
         super(context);
13 15
         startReactApplication(reactInstanceManager, moduleName, passProps);
16
+        scrollViewAttacher = new ScrollViewAttacher(this, this);
14 17
     }
15 18
 
16 19
     @Override
17
-    protected void onDetachedFromWindow() {
18
-        super.onDetachedFromWindow();
20
+    public void onScrollChanged(ScrollDirectionListener.Direction direction) {
21
+
19 22
     }
20 23
 }

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

@@ -9,7 +9,7 @@ public class ScrollDirectionListener implements ViewTreeObserver.OnScrollChanged
9 9
     }
10 10
 
11 11
     public interface OnChanged {
12
-        void onChanged(Direction direction);
12
+        void onScrollChanged(Direction direction);
13 13
     }
14 14
 
15 15
     private final ViewGroup view;
@@ -30,7 +30,7 @@ public class ScrollDirectionListener implements ViewTreeObserver.OnScrollChanged
30 30
         final int scrollY = view.getScrollY();
31 31
         if (isScrollPositionChanged(scrollY) && !isTopOverscroll(scrollY) && !isBottomOverscroll(scrollY)) {
32 32
             lastScrollY = scrollY;
33
-            onChanged.onChanged(getDirection(scrollY));
33
+            onChanged.onScrollChanged(getDirection(scrollY));
34 34
         }
35 35
     }
36 36