diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index d0092602efa..d56799e8409 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -625,7 +625,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { final String componentName, @Nullable ReadableMap props, @Nullable Object stateWrapper, - @Nullable Object eventEmitterWrapper, boolean isLayoutable) { mMountItemDispatcher.addPreAllocateMountItem( @@ -635,7 +634,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener { getFabricComponentName(componentName), props, (StateWrapper) stateWrapper, - (EventEmitterWrapper) eventEmitterWrapper, isLayoutable)); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 73e43c2a18b..51dc02b199e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -169,8 +169,7 @@ static inline void computeBufferSizes( batchMountItemIntsSize += getIntBufferSizeForType(mountItemType); if (mountItemType == CppMountItem::Type::Create) { - batchMountItemObjectsSize += - 4; // component name, props, state, event emitter + batchMountItemObjectsSize += 3; // component name, props, state } } @@ -885,13 +884,6 @@ void Binding::schedulerDidFinishTransaction( cStateWrapper->state_ = mountItem.newChildShadowView.state; } - // Do not hold a reference to javaEventEmitter from the C++ side. - SharedEventEmitter eventEmitter = - mountItem.newChildShadowView.eventEmitter; - auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); - EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - cEventEmitter->eventEmitter = eventEmitter; - temp[0] = mountItem.newChildShadowView.tag; temp[1] = isLayoutable; env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp); @@ -901,7 +893,6 @@ void Binding::schedulerDidFinishTransaction( (*objBufferArray)[objBufferPosition++] = props.get(); (*objBufferArray)[objBufferPosition++] = javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr; - (*objBufferArray)[objBufferPosition++] = javaEventEmitter.get(); } else if (mountItemType == CppMountItem::Type::Insert) { temp[0] = mountItem.newChildShadowView.tag; temp[1] = mountItem.parentShadowView.tag; @@ -1152,13 +1143,8 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( static auto preallocateView = jni::findClassStatic(Binding::UIManagerJavaDescriptor) ->getMethod("preallocateView"); + jint, jint, jstring, ReadableMap::javaobject, jobject, jboolean)>( + "preallocateView"); // Do not hold onto Java object from C // We DO want to hold onto C object from Java, since we don't know the @@ -1170,12 +1156,6 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( cStateWrapper->state_ = shadowView.state; } - // Do not hold a reference to javaEventEmitter from the C++ side. - SharedEventEmitter eventEmitter = shadowView.eventEmitter; - auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); - EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - cEventEmitter->eventEmitter = eventEmitter; - local_ref props = castReadableMap( ReadableNativeMap::newObjectCxxArgs(shadowView.props->rawProps)); auto component = getPlatformComponentName(shadowView); @@ -1187,7 +1167,6 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( component.get(), props.get(), (javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr), - javaEventEmitter.get(), isLayoutableShadowNode); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java index 4e1b3e31f08..e61f26a2dd6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java @@ -529,7 +529,6 @@ public class SurfaceMountingManager { int reactTag, @Nullable ReadableMap props, @Nullable StateWrapper stateWrapper, - @Nullable EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable) { if (isStopped()) { return; @@ -557,7 +556,6 @@ public class SurfaceMountingManager { ViewState viewState = new ViewState(reactTag, view, viewManager); viewState.mCurrentProps = propsDiffMap; viewState.mStateWrapper = stateWrapper; - viewState.mEventEmitter = eventEmitterWrapper; mTagToViewState.put(reactTag, viewState); } @@ -847,7 +845,6 @@ public class SurfaceMountingManager { int reactTag, @Nullable ReadableMap props, @Nullable StateWrapper stateWrapper, - @Nullable EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable) { UiThreadUtil.assertOnUiThread(); if (isStopped()) { @@ -859,7 +856,7 @@ public class SurfaceMountingManager { "View for component " + componentName + " with tag " + reactTag + " already exists."); } - createView(componentName, reactTag, props, stateWrapper, eventEmitterWrapper, isLayoutable); + createView(componentName, reactTag, props, stateWrapper, isLayoutable); } @AnyThread diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java index cd4bb8c5f61..9d2aa1d63c8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java @@ -142,7 +142,6 @@ public class IntBufferBatchMountItem implements MountItem { mIntBuffer[i++], castToProps(mObjBuffer[j++]), castToState(mObjBuffer[j++]), - castToEventEmitter(mObjBuffer[j++]), mIntBuffer[i++] == 1); } else if (type == INSTRUCTION_DELETE) { surfaceMountingManager.deleteView(mIntBuffer[i++]); @@ -203,7 +202,7 @@ public class IntBufferBatchMountItem implements MountItem { for (int k = 0; k < numInstructions; k++) { if (type == INSTRUCTION_CREATE) { String componentName = getFabricComponentName((String) mObjBuffer[j++]); - j += 3; + j += 2; s.append( String.format( "CREATE [%d] - layoutable:%d - %s\n", diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java index 5a0f5241bc8..4516d60dd85 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java @@ -14,7 +14,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.facebook.common.logging.FLog; import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.fabric.events.EventEmitterWrapper; import com.facebook.react.fabric.mounting.MountingManager; import com.facebook.react.fabric.mounting.SurfaceMountingManager; import com.facebook.react.uimanager.StateWrapper; @@ -27,7 +26,6 @@ public class PreAllocateViewMountItem implements MountItem { private final int mReactTag; private final @Nullable ReadableMap mProps; private final @Nullable StateWrapper mStateWrapper; - private final @Nullable EventEmitterWrapper mEventEmitterWrapper; private final boolean mIsLayoutable; public PreAllocateViewMountItem( @@ -36,13 +34,11 @@ public class PreAllocateViewMountItem implements MountItem { @NonNull String component, @Nullable ReadableMap props, @NonNull StateWrapper stateWrapper, - @Nullable EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable) { mComponent = component; mSurfaceId = surfaceId; mProps = props; mStateWrapper = stateWrapper; - mEventEmitterWrapper = eventEmitterWrapper; mReactTag = reactTag; mIsLayoutable = isLayoutable; } @@ -62,7 +58,7 @@ public class PreAllocateViewMountItem implements MountItem { return; } surfaceMountingManager.preallocateView( - mComponent, mReactTag, mProps, mStateWrapper, mEventEmitterWrapper, mIsLayoutable); + mComponent, mReactTag, mProps, mStateWrapper, mIsLayoutable); } @Override