@@ -136,14 +136,6 @@ public String getName() {
136136 return PERFORMANCE_MODULE ;
137137 }
138138
139- public void addListener (String eventName ) {
140-
141- }
142-
143- public void removeListeners (double count ) {
144-
145- }
146-
147139 private void emitNativeStartupTime () {
148140 safelyEmitMark (new PerformanceMark ("nativeLaunchStart" , StartTimeProvider .getStartTime ()));
149141 safelyEmitMark (new PerformanceMark ("nativeLaunchEnd" , StartTimeProvider .getEndTime ()));
@@ -196,7 +188,7 @@ private void emit(PerformanceMetric metric) {
196188 WritableMap map = Arguments .fromBundle (metric .getDetail ());
197189 params .putMap ("detail" , map );
198190 }
199- if (getReactApplicationContext ().hasActiveCatalystInstance ()) {
191+ if (getReactApplicationContext ().hasActiveReactInstance ()) {
200192 getReactApplicationContext ()
201193 .getJSModule (DeviceEventManagerModule .RCTDeviceEventEmitter .class )
202194 .emit ("metric" , params );
@@ -211,9 +203,11 @@ private void emit(PerformanceMark mark) {
211203 WritableMap map = Arguments .fromBundle (mark .getDetail ());
212204 params .putMap ("detail" , map );
213205 }
214- getReactApplicationContext ()
215- .getJSModule (DeviceEventManagerModule .RCTDeviceEventEmitter .class )
216- .emit ("mark" , params );
206+ if (getReactApplicationContext ().hasActiveReactInstance ()) {
207+ getReactApplicationContext ()
208+ .getJSModule (DeviceEventManagerModule .RCTDeviceEventEmitter .class )
209+ .emit ("mark" , params );
210+ }
217211 }
218212
219213 @ Override
@@ -229,4 +223,13 @@ public void invalidate() {
229223 RNPerformance .getInstance ().removeListener (this );
230224 ReactMarker .removeListener (contentAppearedListener );
231225 }
226+
227+ // Fix new arch runtime error
228+ public void addListener (String eventName ) {
229+
230+ }
231+
232+ public void removeListeners (double count ) {
233+
234+ }
232235}
0 commit comments