File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,8 @@ public class FabricUIManager
180
180
private final DispatchUIFrameCallback mDispatchUIFrameCallback ;
181
181
182
182
/** Set of events sent synchronously during the current frame render. Cleared after each frame. */
183
+ @ ThreadConfined (UI )
184
+ @ NonNull
183
185
private final Set <SynchronousEvent > mSynchronousEvents = new HashSet <>();
184
186
185
187
/**
@@ -999,6 +1001,7 @@ public void receiveEvent(
999
1001
}
1000
1002
1001
1003
if (experimentalIsSynchronous ) {
1004
+ UiThreadUtil .assertOnUiThread ();
1002
1005
// add() returns true only if there are no equivalent events already in the set
1003
1006
boolean firstEventForFrame =
1004
1007
mSynchronousEvents .add (new SynchronousEvent (surfaceId , reactTag , eventName ));
@@ -1389,7 +1392,7 @@ public void doFrameGuarded(long frameTimeNanos) {
1389
1392
} catch (Exception ex ) {
1390
1393
FLog .e (TAG , "Exception thrown when executing UIFrameGuarded" , ex );
1391
1394
mIsMountingEnabled = false ;
1392
- throw ex ;
1395
+ throw new RuntimeException ( "Exception thrown when executing UIFrameGuarded" , ex ) ;
1393
1396
} finally {
1394
1397
schedule ();
1395
1398
}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import android.annotation.SuppressLint
11
11
import com.facebook.jni.HybridClassBase
12
12
import com.facebook.proguard.annotations.DoNotStripAny
13
13
import com.facebook.react.bridge.NativeMap
14
+ import com.facebook.react.bridge.UiThreadUtil
14
15
import com.facebook.react.bridge.WritableMap
15
16
import com.facebook.react.fabric.FabricSoLoader.staticInit
16
17
import com.facebook.react.uimanager.events.EventCategoryDef
@@ -55,6 +56,7 @@ public class EventEmitterWrapper private constructor() : HybridClassBase() {
55
56
if (! isValid) {
56
57
return
57
58
}
59
+ UiThreadUtil .assertOnUiThread()
58
60
dispatchEventSynchronously(eventName, params as NativeMap ? )
59
61
}
60
62
You can’t perform that action at this time.
0 commit comments