|
@@ -1,7 +1,5 @@
|
1
|
1
|
package com.reactnativenavigation.react;
|
2
|
2
|
|
3
|
|
-import android.support.annotation.NonNull;
|
4
|
|
-
|
5
|
3
|
import com.facebook.react.bridge.Arguments;
|
6
|
4
|
import com.facebook.react.bridge.ReactContext;
|
7
|
5
|
import com.facebook.react.bridge.WritableMap;
|
|
@@ -10,10 +8,11 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
10
|
8
|
import static com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
|
11
|
9
|
|
12
|
10
|
public class NavigationEvent {
|
13
|
|
- private static final String onAppLaunched = "RNN.onAppLaunched";
|
|
11
|
+ private static final String onAppLaunched = "RNN.appLaunched";
|
14
|
12
|
private static final String componentDidAppear = "RNN.componentDidAppear";
|
15
|
13
|
private static final String componentDidDisappear = "RNN.componentDidDisappear";
|
16
|
|
- private static final String onNavigationButtonPressed = "RNN.onNavigationButtonPressed";
|
|
14
|
+ private static final String nativeEvent = "RNN.nativeEvent";
|
|
15
|
+ private static final String buttonPressedEvent = "buttonPressed";
|
17
|
16
|
|
18
|
17
|
private final RCTDeviceEventEmitter emitter;
|
19
|
18
|
|
|
@@ -37,16 +36,19 @@ public class NavigationEvent {
|
37
|
36
|
WritableMap map = Arguments.createMap();
|
38
|
37
|
map.putString("componentId", id);
|
39
|
38
|
map.putString("componentName", componentName);
|
40
|
|
-
|
41
|
39
|
emit(componentDidAppear, map);
|
42
|
40
|
}
|
43
|
41
|
|
44
|
42
|
public void sendOnNavigationButtonPressed(String id, String buttonId) {
|
45
|
|
- WritableMap map = Arguments.createMap();
|
46
|
|
- map.putString("componentId", id);
|
47
|
|
- map.putString("buttonId", buttonId);
|
|
43
|
+ WritableMap params = Arguments.createMap();
|
|
44
|
+ params.putString("componentId", id);
|
|
45
|
+ params.putString("buttonId", buttonId);
|
|
46
|
+
|
|
47
|
+ WritableMap map = Arguments.createMap();
|
|
48
|
+ map.putString("name", buttonPressedEvent);
|
|
49
|
+ map.putMap("params", params);
|
48
|
50
|
|
49
|
|
- emit(onNavigationButtonPressed, map);
|
|
51
|
+ emit(nativeEvent, map);
|
50
|
52
|
}
|
51
|
53
|
|
52
|
54
|
private void emit(String eventName) {
|