|
@@ -34,57 +34,61 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
34
|
34
|
|
35
|
35
|
@ReactMethod
|
36
|
36
|
public void setRoot(final ReadableMap layoutTree) {
|
37
|
|
- NavigationActivity.instance.runOnUiThread(new Runnable() {
|
|
37
|
+ getActivity().runOnUiThread(new Runnable() {
|
38
|
38
|
@Override
|
39
|
39
|
public void run() {
|
40
|
40
|
LayoutFactory factory =
|
41
|
|
- new LayoutFactory(NavigationActivity.instance, new LayoutFactory.ReactRootViewCreator() {
|
|
41
|
+ new LayoutFactory(getActivity(), new LayoutFactory.ReactRootViewCreator() {
|
42
|
42
|
@Override
|
43
|
43
|
public View create(String id, String name) {
|
44
|
|
- ReactRootView rootView = new ReactRootView(NavigationActivity.instance);
|
|
44
|
+ ReactRootView rootView = new ReactRootView(getActivity());
|
45
|
45
|
Bundle opts = new Bundle();
|
46
|
46
|
opts.putString("id", id);
|
47
|
|
- rootView.startReactApplication(NavigationActivity.instance.getHost().getReactInstanceManager(), name, opts);
|
|
47
|
+ rootView.startReactApplication(getActivity().getHost().getReactInstanceManager(), name, opts);
|
48
|
48
|
return rootView;
|
49
|
49
|
}
|
50
|
50
|
}, new BottomTabsCreator());
|
51
|
51
|
|
52
|
52
|
final LayoutNode layoutTreeRoot = readableMapToLayoutNode(layoutTree);
|
53
|
53
|
final View rootView = factory.create(layoutTreeRoot);
|
54
|
|
- NavigationActivity.instance.setContentView(rootView);
|
|
54
|
+ getActivity().setContentView(rootView);
|
55
|
55
|
}
|
56
|
56
|
});
|
57
|
57
|
}
|
58
|
58
|
|
|
59
|
+ private NavigationActivity getActivity() {
|
|
60
|
+ return (NavigationActivity) getCurrentActivity();
|
|
61
|
+ }
|
|
62
|
+
|
59
|
63
|
@ReactMethod
|
60
|
64
|
public void push(String onContainerId, final ReadableMap layout) {
|
61
|
|
- NavigationActivity.instance.runOnUiThread(new Runnable() {
|
|
65
|
+ getActivity().runOnUiThread(new Runnable() {
|
62
|
66
|
@Override
|
63
|
67
|
public void run() {
|
64
|
68
|
LayoutFactory factory =
|
65
|
|
- new LayoutFactory(NavigationActivity.instance, new LayoutFactory.ReactRootViewCreator() {
|
|
69
|
+ new LayoutFactory(getActivity(), new LayoutFactory.ReactRootViewCreator() {
|
66
|
70
|
@Override
|
67
|
71
|
public View create(String id, String name) {
|
68
|
|
- ReactRootView rootView = new ReactRootView(NavigationActivity.instance);
|
|
72
|
+ ReactRootView rootView = new ReactRootView(getActivity());
|
69
|
73
|
Bundle opts = new Bundle();
|
70
|
74
|
opts.putString("id", id);
|
71
|
|
- rootView.startReactApplication(NavigationActivity.instance.getHost().getReactInstanceManager(), name, opts);
|
|
75
|
+ rootView.startReactApplication(getActivity().getHost().getReactInstanceManager(), name, opts);
|
72
|
76
|
return rootView;
|
73
|
77
|
}
|
74
|
78
|
}, new BottomTabsCreator());
|
75
|
79
|
final LayoutNode layoutNode = readableMapToLayoutNode(layout);
|
76
|
80
|
final View rootView = factory.create(layoutNode);
|
77
|
|
- ((StackLayout) NavigationActivity.instance.getContentView()).push(rootView);
|
|
81
|
+ ((StackLayout) getActivity().getContentView()).push(rootView);
|
78
|
82
|
}
|
79
|
83
|
});
|
80
|
84
|
}
|
81
|
85
|
|
82
|
86
|
@ReactMethod
|
83
|
87
|
public void pop(String onContainerId) {
|
84
|
|
- NavigationActivity.instance.runOnUiThread(new Runnable() {
|
|
88
|
+ getActivity().runOnUiThread(new Runnable() {
|
85
|
89
|
@Override
|
86
|
90
|
public void run() {
|
87
|
|
- ((StackLayout) NavigationActivity.instance.getContentView()).pop();
|
|
91
|
+ ((StackLayout) getActivity().getContentView()).pop();
|
88
|
92
|
}
|
89
|
93
|
});
|
90
|
94
|
}
|