|
@@ -36,16 +36,17 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
36
|
36
|
NavigationActivity.instance.runOnUiThread(new Runnable() {
|
37
|
37
|
@Override
|
38
|
38
|
public void run() {
|
39
|
|
- LayoutFactory factory = new LayoutFactory(NavigationActivity.instance, new LayoutFactory.ReactRootViewCreator() {
|
40
|
|
- @Override
|
41
|
|
- public View create(String id, String name) {
|
42
|
|
- ReactRootView rootView = new ReactRootView(NavigationActivity.instance);
|
43
|
|
- Bundle opts = new Bundle();
|
44
|
|
- opts.putString("id", id);
|
45
|
|
- rootView.startReactApplication(NavigationActivity.instance.getHost().getReactInstanceManager(), name, opts);
|
46
|
|
- return rootView;
|
47
|
|
- }
|
48
|
|
- }, new BottomTabsCreator());
|
|
39
|
+ LayoutFactory factory =
|
|
40
|
+ new LayoutFactory(NavigationActivity.instance, new LayoutFactory.ReactRootViewCreator() {
|
|
41
|
+ @Override
|
|
42
|
+ public View create(String id, String name) {
|
|
43
|
+ ReactRootView rootView = new ReactRootView(NavigationActivity.instance);
|
|
44
|
+ Bundle opts = new Bundle();
|
|
45
|
+ opts.putString("id", id);
|
|
46
|
+ rootView.startReactApplication(NavigationActivity.instance.getHost().getReactInstanceManager(), name, opts);
|
|
47
|
+ return rootView;
|
|
48
|
+ }
|
|
49
|
+ }, new BottomTabsCreator());
|
49
|
50
|
|
50
|
51
|
final LayoutNode layoutTreeRoot = readableMapToLayoutNode(layoutTree);
|
51
|
52
|
final View rootView = factory.create(layoutTreeRoot);
|
|
@@ -54,6 +55,29 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
54
|
55
|
});
|
55
|
56
|
}
|
56
|
57
|
|
|
58
|
+ @ReactMethod
|
|
59
|
+ public void push(String onContainerId, final ReadableMap layout) {
|
|
60
|
+ NavigationActivity.instance.runOnUiThread(new Runnable() {
|
|
61
|
+ @Override
|
|
62
|
+ public void run() {
|
|
63
|
+ LayoutFactory factory =
|
|
64
|
+ new LayoutFactory(NavigationActivity.instance, new LayoutFactory.ReactRootViewCreator() {
|
|
65
|
+ @Override
|
|
66
|
+ public View create(String id, String name) {
|
|
67
|
+ ReactRootView rootView = new ReactRootView(NavigationActivity.instance);
|
|
68
|
+ Bundle opts = new Bundle();
|
|
69
|
+ opts.putString("id", id);
|
|
70
|
+ rootView.startReactApplication(NavigationActivity.instance.getHost().getReactInstanceManager(), name, opts);
|
|
71
|
+ return rootView;
|
|
72
|
+ }
|
|
73
|
+ }, new BottomTabsCreator());
|
|
74
|
+ final LayoutNode layoutNode = readableMapToLayoutNode(layout);
|
|
75
|
+ final View rootView = factory.create(layoutNode);
|
|
76
|
+ NavigationActivity.instance.setContentView(rootView);
|
|
77
|
+ }
|
|
78
|
+ });
|
|
79
|
+ }
|
|
80
|
+
|
57
|
81
|
private LayoutNode readableMapToLayoutNode(ReadableMap readableMap) {
|
58
|
82
|
final LayoutNode layoutNode = new LayoutNode();
|
59
|
83
|
layoutNode.id = readableMap.getString("id");
|
|
@@ -72,7 +96,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
72
|
96
|
|
73
|
97
|
private Map<String, Object> readableMapToJavaMap(ReadableMap readableMap) {
|
74
|
98
|
final Map<String, Object> map = new HashMap<>();
|
75
|
|
- for (ReadableMapKeySetIterator it = readableMap.keySetIterator(); it.hasNextKey();) {
|
|
99
|
+ for (ReadableMapKeySetIterator it = readableMap.keySetIterator(); it.hasNextKey(); ) {
|
76
|
100
|
final String key = it.nextKey();
|
77
|
101
|
switch (readableMap.getType(key)) {
|
78
|
102
|
case String:
|