|
@@ -8,19 +8,24 @@ import com.facebook.react.ReactInstanceManager;
|
8
|
8
|
import com.facebook.react.ReactRootView;
|
9
|
9
|
import com.reactnativenavigation.react.ReactViewHacks;
|
10
|
10
|
|
11
|
|
-public class ContentView extends ReactRootView implements ScrollDirectionListener.OnChanged {
|
|
11
|
+public class ContentView extends ReactRootView {
|
12
|
12
|
|
13
|
|
- private final ScrollViewAttacher scrollViewAttacher;
|
|
13
|
+ private final ReactInstanceManager reactInstanceManager;
|
|
14
|
+ private final String moduleName;
|
|
15
|
+ private final Bundle passProps;
|
|
16
|
+ private final ScrollDirectionListener.OnScrollChanged scrollListener;
|
14
|
17
|
|
15
|
|
- public ContentView(Context context, ReactInstanceManager reactInstanceManager, String moduleName, Bundle passProps) {
|
|
18
|
+ public ContentView(Context context, ReactInstanceManager reactInstanceManager, String moduleName, Bundle passProps, ScrollDirectionListener.OnScrollChanged scrollListener) {
|
16
|
19
|
super(context);
|
17
|
|
- startReactApplication(reactInstanceManager, moduleName, passProps);
|
18
|
|
- scrollViewAttacher = new ScrollViewAttacher(this, this);
|
|
20
|
+ this.reactInstanceManager = reactInstanceManager;
|
|
21
|
+ this.moduleName = moduleName;
|
|
22
|
+ this.passProps = passProps;
|
|
23
|
+ this.scrollListener = scrollListener;
|
19
|
24
|
}
|
20
|
25
|
|
21
|
|
- @Override
|
22
|
|
- public void onScrollChanged(ScrollDirectionListener.Direction direction) {
|
23
|
|
-
|
|
26
|
+ public void init() {
|
|
27
|
+ startReactApplication(reactInstanceManager, moduleName, passProps);
|
|
28
|
+ new ScrollViewAttacher(this, scrollListener).attach();
|
24
|
29
|
}
|
25
|
30
|
|
26
|
31
|
public void removeFromParentWithoutUnmount() {
|
|
@@ -33,5 +38,4 @@ public class ContentView extends ReactRootView implements ScrollDirectionListene
|
33
|
38
|
ReactViewHacks.ensureUnmountOnDetachedFromWindow(this);
|
34
|
39
|
((ViewGroup) getParent()).removeView(this);
|
35
|
40
|
}
|
36
|
|
-
|
37
|
41
|
}
|