mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
remove event emitter from view preallocation (#45351)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45351 changelog: [internal] event emitter is always null during view preallocation. Let's just remove it completely from the method signature Reviewed By: rubennorte Differential Revision: D59522141 fbshipit-source-id: cb4f3b314607b4ee8b2209a8ab55e066ee7e075a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b4b6614034
commit
082706ccd4
@@ -2803,7 +2803,7 @@ public class com/facebook/react/fabric/mounting/SurfaceMountingManager {
|
||||
public fun getViewExists (I)Z
|
||||
public fun isRootViewAttached ()Z
|
||||
public fun isStopped ()Z
|
||||
public fun preallocateView (Ljava/lang/String;ILcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/uimanager/StateWrapper;Lcom/facebook/react/fabric/events/EventEmitterWrapper;Z)V
|
||||
public fun preallocateView (Ljava/lang/String;ILcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/uimanager/StateWrapper;Z)V
|
||||
public fun printSurfaceState ()V
|
||||
public fun receiveCommand (IILcom/facebook/react/bridge/ReadableArray;)V
|
||||
public fun receiveCommand (ILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
|
||||
@@ -2841,7 +2841,7 @@ public final class com/facebook/react/fabric/mounting/mountitems/MountItemFactor
|
||||
public static final fun createDispatchCommandMountItem (IIILcom/facebook/react/bridge/ReadableArray;)Lcom/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem;
|
||||
public static final fun createDispatchCommandMountItem (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)Lcom/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem;
|
||||
public static final fun createIntBufferBatchMountItem (I[I[Ljava/lang/Object;I)Lcom/facebook/react/fabric/mounting/mountitems/MountItem;
|
||||
public static final fun createPreAllocateViewMountItem (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/uimanager/StateWrapper;Lcom/facebook/react/fabric/events/EventEmitterWrapper;Z)Lcom/facebook/react/fabric/mounting/mountitems/MountItem;
|
||||
public static final fun createPreAllocateViewMountItem (IILjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/uimanager/StateWrapper;Z)Lcom/facebook/react/fabric/mounting/mountitems/MountItem;
|
||||
public static final fun createSendAccessibilityEventMountItem (III)Lcom/facebook/react/fabric/mounting/mountitems/MountItem;
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -750,7 +750,6 @@ public class FabricUIManager
|
||||
final String componentName,
|
||||
@Nullable Object props,
|
||||
@Nullable Object stateWrapper,
|
||||
@Nullable Object eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
|
||||
mMountItemDispatcher.addPreAllocateMountItem(
|
||||
@@ -760,7 +759,6 @@ public class FabricUIManager
|
||||
componentName,
|
||||
(ReadableMap) props,
|
||||
(StateWrapper) stateWrapper,
|
||||
(EventEmitterWrapper) eventEmitterWrapper,
|
||||
isLayoutable));
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -1238,7 +1238,6 @@ public class SurfaceMountingManager {
|
||||
int reactTag,
|
||||
@Nullable ReadableMap props,
|
||||
@Nullable StateWrapper stateWrapper,
|
||||
@Nullable EventEmitterWrapper eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
@@ -1251,8 +1250,7 @@ public class SurfaceMountingManager {
|
||||
return;
|
||||
}
|
||||
|
||||
createViewUnsafe(
|
||||
componentName, reactTag, props, stateWrapper, eventEmitterWrapper, isLayoutable);
|
||||
createViewUnsafe(componentName, reactTag, props, stateWrapper, null, isLayoutable);
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
|
||||
+1
-4
@@ -9,7 +9,6 @@ package com.facebook.react.fabric.mounting.mountitems
|
||||
|
||||
import com.facebook.react.bridge.ReadableArray
|
||||
import com.facebook.react.bridge.ReadableMap
|
||||
import com.facebook.react.fabric.events.EventEmitterWrapper
|
||||
import com.facebook.react.uimanager.StateWrapper
|
||||
|
||||
/** Factory class that expose creation of [MountItem] */
|
||||
@@ -50,11 +49,9 @@ public object MountItemFactory {
|
||||
component: String,
|
||||
props: ReadableMap?,
|
||||
stateWrapper: StateWrapper?,
|
||||
eventEmitterWrapper: EventEmitterWrapper?,
|
||||
isLayoutable: Boolean
|
||||
): MountItem =
|
||||
PreAllocateViewMountItem(
|
||||
surfaceId, reactTag, component, props, stateWrapper, eventEmitterWrapper, isLayoutable)
|
||||
PreAllocateViewMountItem(surfaceId, reactTag, component, props, stateWrapper, isLayoutable)
|
||||
|
||||
/**
|
||||
* @return a [MountItem] that will be read and execute a collection of MountItems serialized in
|
||||
|
||||
+1
-5
@@ -16,7 +16,6 @@ import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
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;
|
||||
@@ -30,7 +29,6 @@ final 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;
|
||||
|
||||
PreAllocateViewMountItem(
|
||||
@@ -39,13 +37,11 @@ final class PreAllocateViewMountItem implements MountItem {
|
||||
@NonNull String component,
|
||||
@Nullable ReadableMap props,
|
||||
@Nullable StateWrapper stateWrapper,
|
||||
@Nullable EventEmitterWrapper eventEmitterWrapper,
|
||||
boolean isLayoutable) {
|
||||
mComponent = getFabricComponentName(component);
|
||||
mSurfaceId = surfaceId;
|
||||
mProps = props;
|
||||
mStateWrapper = stateWrapper;
|
||||
mEventEmitterWrapper = eventEmitterWrapper;
|
||||
mReactTag = reactTag;
|
||||
mIsLayoutable = isLayoutable;
|
||||
}
|
||||
@@ -65,7 +61,7 @@ final class PreAllocateViewMountItem implements MountItem {
|
||||
return;
|
||||
}
|
||||
surfaceMountingManager.preallocateView(
|
||||
mComponent, mReactTag, mProps, mStateWrapper, mEventEmitterWrapper, mIsLayoutable);
|
||||
mComponent, mReactTag, mProps, mStateWrapper, mIsLayoutable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-6
@@ -817,8 +817,7 @@ void FabricMountingManager::maybePreallocateShadowView(
|
||||
|
||||
static auto preallocateView =
|
||||
JFabricUIManager::javaClassStatic()
|
||||
->getMethod<void(
|
||||
jint, jint, jstring, jobject, jobject, jobject, jboolean)>(
|
||||
->getMethod<void(jint, jint, jstring, jobject, jobject, jboolean)>(
|
||||
"preallocateView");
|
||||
|
||||
// Do not hold onto Java object from C
|
||||
@@ -831,9 +830,6 @@ void FabricMountingManager::maybePreallocateShadowView(
|
||||
cStateWrapper->setState(shadowView.state);
|
||||
}
|
||||
|
||||
// Do not hold a reference to javaEventEmitter from the C++ side.
|
||||
jni::local_ref<EventEmitterWrapper::JavaPart> javaEventEmitter = nullptr;
|
||||
|
||||
jni::local_ref<jobject> props = getProps({}, shadowView);
|
||||
|
||||
auto component = getPlatformComponentName(shadowView);
|
||||
@@ -845,7 +841,6 @@ void FabricMountingManager::maybePreallocateShadowView(
|
||||
component.get(),
|
||||
props.get(),
|
||||
(javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr),
|
||||
(javaEventEmitter != nullptr ? javaEventEmitter.get() : nullptr),
|
||||
isLayoutableShadowNode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user