|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.reactnativenavigation.views;
|
2
|
2
|
|
3
|
3
|
import android.content.Context;
|
|
4
|
+import android.os.Bundle;
|
4
|
5
|
import android.view.View;
|
5
|
6
|
|
6
|
7
|
import com.facebook.react.ReactRootView;
|
|
@@ -13,6 +14,7 @@ import com.reactnativenavigation.views.utils.ViewMeasurer;
|
13
|
14
|
public class ContentView extends ReactRootView {
|
14
|
15
|
private final String screenId;
|
15
|
16
|
private final NavigationParams navigationParams;
|
|
17
|
+ private Bundle initialProps;
|
16
|
18
|
|
17
|
19
|
boolean isContentVisible = false;
|
18
|
20
|
private SingleScreen.OnDisplayListener onDisplayListener;
|
|
@@ -23,9 +25,14 @@ public class ContentView extends ReactRootView {
|
23
|
25
|
}
|
24
|
26
|
|
25
|
27
|
public ContentView(Context context, String screenId, NavigationParams navigationParams) {
|
|
28
|
+ this(context, screenId, navigationParams, Bundle.EMPTY);
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ public ContentView(Context context, String screenId, NavigationParams navigationParams, Bundle initialProps) {
|
26
|
32
|
super(context);
|
27
|
33
|
this.screenId = screenId;
|
28
|
34
|
this.navigationParams = navigationParams;
|
|
35
|
+ this.initialProps = initialProps;
|
29
|
36
|
attachToJS();
|
30
|
37
|
viewMeasurer = new ViewMeasurer();
|
31
|
38
|
}
|
|
@@ -35,8 +42,18 @@ public class ContentView extends ReactRootView {
|
35
|
42
|
}
|
36
|
43
|
|
37
|
44
|
private void attachToJS() {
|
38
|
|
- startReactApplication(NavigationApplication.instance.getReactGateway().getReactInstanceManager(), screenId,
|
39
|
|
- navigationParams.toBundle());
|
|
45
|
+ navigationParams.toBundle().putAll(initialProps);
|
|
46
|
+ startReactApplication(NavigationApplication.instance.getReactGateway().getReactInstanceManager(),
|
|
47
|
+ screenId,
|
|
48
|
+ createInitialParams()
|
|
49
|
+ );
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ private Bundle createInitialParams() {
|
|
53
|
+ final Bundle params = new Bundle();
|
|
54
|
+ params.putAll(navigationParams.toBundle());
|
|
55
|
+ params.putAll(initialProps);
|
|
56
|
+ return params;
|
40
|
57
|
}
|
41
|
58
|
|
42
|
59
|
public String getNavigatorEventId() {
|