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
180180 private final DispatchUIFrameCallback mDispatchUIFrameCallback ;
181181
182182 /** Set of events sent synchronously during the current frame render. Cleared after each frame. */
183+ @ ThreadConfined (UI )
184+ @ NonNull
183185 private final Set <SynchronousEvent > mSynchronousEvents = new HashSet <>();
184186
185187 /**
@@ -999,6 +1001,7 @@ public void receiveEvent(
9991001 }
10001002
10011003 if (experimentalIsSynchronous ) {
1004+ UiThreadUtil .assertOnUiThread ();
10021005 // add() returns true only if there are no equivalent events already in the set
10031006 boolean firstEventForFrame =
10041007 mSynchronousEvents .add (new SynchronousEvent (surfaceId , reactTag , eventName ));
@@ -1389,7 +1392,7 @@ public void doFrameGuarded(long frameTimeNanos) {
13891392 } catch (Exception ex ) {
13901393 FLog .e (TAG , "Exception thrown when executing UIFrameGuarded" , ex );
13911394 mIsMountingEnabled = false ;
1392- throw ex ;
1395+ throw new RuntimeException ( "Exception thrown when executing UIFrameGuarded" , ex ) ;
13931396 } finally {
13941397 schedule ();
13951398 }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import android.annotation.SuppressLint
1111import com.facebook.jni.HybridClassBase
1212import com.facebook.proguard.annotations.DoNotStripAny
1313import com.facebook.react.bridge.NativeMap
14+ import com.facebook.react.bridge.UiThreadUtil
1415import com.facebook.react.bridge.WritableMap
1516import com.facebook.react.fabric.FabricSoLoader.staticInit
1617import com.facebook.react.uimanager.events.EventCategoryDef
@@ -55,6 +56,7 @@ public class EventEmitterWrapper private constructor() : HybridClassBase() {
5556 if (! isValid) {
5657 return
5758 }
59+ UiThreadUtil .assertOnUiThread()
5860 dispatchEventSynchronously(eventName, params as NativeMap ? )
5961 }
6062
You can’t perform that action at this time.
0 commit comments