|
@@ -9,7 +9,6 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
9
|
9
|
import com.facebook.react.bridge.ReactMethod;
|
10
|
10
|
import com.facebook.react.bridge.ReadableMap;
|
11
|
11
|
import com.reactnativenavigation.NavigationActivity;
|
12
|
|
-import com.reactnativenavigation.parse.parsers.JSONParser;
|
13
|
12
|
import com.reactnativenavigation.parse.LayoutFactory;
|
14
|
13
|
import com.reactnativenavigation.parse.LayoutNode;
|
15
|
14
|
import com.reactnativenavigation.parse.parsers.LayoutNodeParser;
|
|
@@ -19,6 +18,8 @@ import com.reactnativenavigation.utils.UiThread;
|
19
|
18
|
import com.reactnativenavigation.viewcontrollers.Navigator;
|
20
|
19
|
import com.reactnativenavigation.viewcontrollers.ViewController;
|
21
|
20
|
|
|
21
|
+import org.json.JSONObject;
|
|
22
|
+
|
22
|
23
|
public class NavigationModule extends ReactContextBaseJavaModule {
|
23
|
24
|
private static final String NAME = "RNNBridgeModule";
|
24
|
25
|
private final ReactInstanceManager reactInstanceManager;
|
|
@@ -36,7 +37,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
36
|
37
|
|
37
|
38
|
@ReactMethod
|
38
|
39
|
public void setRoot(final ReadableMap rawLayoutTree, final Promise promise) {
|
39
|
|
- final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
|
|
40
|
+ final LayoutNode layoutTree = LayoutNodeParser.parse(new JSONObject(rawLayoutTree.toHashMap()));
|
40
|
41
|
handle(() -> {
|
41
|
42
|
final ViewController viewController = newLayoutFactory().create(layoutTree);
|
42
|
43
|
navigator().setRoot(viewController, promise);
|
|
@@ -45,19 +46,19 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
45
|
46
|
|
46
|
47
|
@ReactMethod
|
47
|
48
|
public void setDefaultOptions(final ReadableMap options) {
|
48
|
|
- final Options defaultOptions = Options.parse(new TypefaceLoader(activity()), JSONParser.parse(options));
|
|
49
|
+ final Options defaultOptions = Options.parse(new TypefaceLoader(activity()), new JSONObject(options.toHashMap()));
|
49
|
50
|
handle(() -> navigator().setDefaultOptions(defaultOptions));
|
50
|
51
|
}
|
51
|
52
|
|
52
|
53
|
@ReactMethod
|
53
|
54
|
public void setOptions(final String onComponentId, final ReadableMap options) {
|
54
|
|
- final Options navOptions = Options.parse(new TypefaceLoader(activity()), JSONParser.parse(options));
|
|
55
|
+ final Options navOptions = Options.parse(new TypefaceLoader(activity()), new JSONObject(options.toHashMap()));
|
55
|
56
|
handle(() -> navigator().setOptions(onComponentId, navOptions));
|
56
|
57
|
}
|
57
|
58
|
|
58
|
59
|
@ReactMethod
|
59
|
60
|
public void push(final String onComponentId, final ReadableMap rawLayoutTree, final Promise promise) {
|
60
|
|
- final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
|
|
61
|
+ final LayoutNode layoutTree = LayoutNodeParser.parse(new JSONObject(rawLayoutTree.toHashMap()));
|
61
|
62
|
handle(() -> {
|
62
|
63
|
final ViewController viewController = newLayoutFactory().create(layoutTree);
|
63
|
64
|
navigator().push(onComponentId, viewController, promise);
|
|
@@ -81,7 +82,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
81
|
82
|
|
82
|
83
|
@ReactMethod
|
83
|
84
|
public void showModal(final ReadableMap rawLayoutTree, final Promise promise) {
|
84
|
|
- final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
|
|
85
|
+ final LayoutNode layoutTree = LayoutNodeParser.parse(new JSONObject(rawLayoutTree.toHashMap()));
|
85
|
86
|
handle(() -> {
|
86
|
87
|
final ViewController viewController = newLayoutFactory().create(layoutTree);
|
87
|
88
|
navigator().showModal(viewController, promise);
|
|
@@ -100,7 +101,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
100
|
101
|
|
101
|
102
|
@ReactMethod
|
102
|
103
|
public void showOverlay(final ReadableMap rawLayoutTree) {
|
103
|
|
- final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
|
|
104
|
+ final LayoutNode layoutTree = LayoutNodeParser.parse(new JSONObject(rawLayoutTree.toHashMap()));
|
104
|
105
|
handle(() -> {
|
105
|
106
|
final ViewController viewController = newLayoutFactory().create(layoutTree);
|
106
|
107
|
navigator().showOverlay(viewController);
|