-
public class MountingManager
Class responsible for actually dispatching view updates enqueued via on the UI thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
MountingManager.MountItemExecutor
-
Constructor Summary
Constructors Constructor Description MountingManager(ViewManagerRegistry viewManagerRegistry, MountingManager.MountItemExecutor mountItemExecutor)
-
Method Summary
Modifier and Type Method Description SurfaceMountingManager
startSurface(int surfaceId, ThemedReactContext reactContext, @Nullable() View rootView)
Starts surface without attaching the view. void
attachRootView(int surfaceId, @NonNull() View rootView, ThemedReactContext themedReactContext)
void
stopSurface(int surfaceId)
SurfaceMountingManager
getSurfaceManager(int surfaceId)
SurfaceMountingManager
getSurfaceManagerEnforced(int surfaceId, String context)
boolean
surfaceIsStopped(int surfaceId)
boolean
isWaitingForViewAttach(int surfaceId)
SurfaceMountingManager
getSurfaceManagerForView(int reactTag)
Get SurfaceMountingManager associated with a ReactTag. SurfaceMountingManager
getSurfaceManagerForViewEnforced(int reactTag)
boolean
getViewExists(int reactTag)
void
receiveCommand(int surfaceId, int reactTag, int commandId, @Nullable() ReadableArray commandArgs)
void
receiveCommand(int surfaceId, int reactTag, @NonNull() String commandId, @Nullable() ReadableArray commandArgs)
void
sendAccessibilityEvent(int surfaceId, int reactTag, int eventType)
Send an accessibility eventType to a Native View. void
updateProps(int reactTag, @Nullable() ReadableMap props)
void
clearJSResponder()
Clears the JS Responder specified by setJSResponder. EventEmitterWrapper
getEventEmitter(int surfaceId, int reactTag)
long
measure(@NonNull() ReactContext context, @NonNull() String componentName, @NonNull() ReadableMap localData, @NonNull() ReadableMap props, @NonNull() ReadableMap state, float width, @NonNull() YogaMeasureMode widthMode, float height, @NonNull() YogaMeasureMode heightMode, @Nullable() Array<float> attachmentsPositions)
Measure a component, given localData, props, state, and measurement information. long
measureMapBuffer(@NonNull() ReactContext context, @NonNull() String componentName, @NonNull() MapBuffer localData, @NonNull() MapBuffer props, @Nullable() MapBuffer state, float width, @NonNull() YogaMeasureMode widthMode, float height, @NonNull() YogaMeasureMode heightMode, @Nullable() Array<float> attachmentsPositions)
Measure a component, given localData, props, state, and measurement information. void
initializeViewManager(String componentName)
-
-
Constructor Detail
-
MountingManager
MountingManager(ViewManagerRegistry viewManagerRegistry, MountingManager.MountItemExecutor mountItemExecutor)
-
-
Method Detail
-
startSurface
@AnyThread() SurfaceMountingManager startSurface(int surfaceId, ThemedReactContext reactContext, @Nullable() View rootView)
Starts surface without attaching the view. All view operations executed against that surfacewill be queued until the view is attached.
-
attachRootView
@AnyThread() void attachRootView(int surfaceId, @NonNull() View rootView, ThemedReactContext themedReactContext)
-
stopSurface
@AnyThread() void stopSurface(int surfaceId)
-
getSurfaceManager
@Nullable() SurfaceMountingManager getSurfaceManager(int surfaceId)
-
getSurfaceManagerEnforced
@NonNull() SurfaceMountingManager getSurfaceManagerEnforced(int surfaceId, String context)
-
surfaceIsStopped
boolean surfaceIsStopped(int surfaceId)
-
isWaitingForViewAttach
boolean isWaitingForViewAttach(int surfaceId)
-
getSurfaceManagerForView
@Nullable() SurfaceMountingManager getSurfaceManagerForView(int reactTag)
Get SurfaceMountingManager associated with a ReactTag. Unfortunately, this requires lookupsover N maps, where N is the number of active or recently-stopped Surfaces. Each lookup willcost `log(M)` operations where M is the number of reactTags in the surface, so the total costper lookup is `O(N * log(M))`.
To mitigate this cost, we attempt to keep track of the "most recent" SurfaceMountingManagerand do lookups in it first. For the vast majority of use-cases, except for events or operationssent to off-screen surfaces, or use-cases where multiple surfaces are visible and interactable,this will reduce the lookup time to `O(log(M))`. Someone smarter than me could probably figureout an amortized time.
-
getSurfaceManagerForViewEnforced
@NonNull()@AnyThread() SurfaceMountingManager getSurfaceManagerForViewEnforced(int reactTag)
-
getViewExists
boolean getViewExists(int reactTag)
-
receiveCommand
@Deprecated() void receiveCommand(int surfaceId, int reactTag, int commandId, @Nullable() ReadableArray commandArgs)
-
receiveCommand
void receiveCommand(int surfaceId, int reactTag, @NonNull() String commandId, @Nullable() ReadableArray commandArgs)
-
sendAccessibilityEvent
void sendAccessibilityEvent(int surfaceId, int reactTag, int eventType)
Send an accessibility eventType to a Native View. eventType is any valid `AccessibilityEvent.X`value.
Why accept `-1` SurfaceId? Currently there are calls to UIManager.sendAccessibilityEventwhich is a legacy API and accepts only reactTag. We will have to investigate and migrate awayfrom those calls over time.
- Parameters:
surfaceId
- that identifies the surface or -1 to temporarily support backwardcompatibility.reactTag
- that identifies the react Tag of the view.eventType
- that identifies Android eventType.
-
updateProps
@UiThread() void updateProps(int reactTag, @Nullable() ReadableMap props)
-
clearJSResponder
@UiThread() void clearJSResponder()
Clears the JS Responder specified by setJSResponder. After thismethod is called, all the touch events are going to be handled by JS.
-
getEventEmitter
@AnyThread()@Nullable() EventEmitterWrapper getEventEmitter(int surfaceId, int reactTag)
-
measure
@AnyThread() long measure(@NonNull() ReactContext context, @NonNull() String componentName, @NonNull() ReadableMap localData, @NonNull() ReadableMap props, @NonNull() ReadableMap state, float width, @NonNull() YogaMeasureMode widthMode, float height, @NonNull() YogaMeasureMode heightMode, @Nullable() Array<float> attachmentsPositions)
Measure a component, given localData, props, state, and measurement information. This needs toremain here for now - and not in SurfaceMountingManager - because sometimes measures are madeoutside of the context of a Surface; especially from C++ before StartSurface is called.
-
measureMapBuffer
@AnyThread() long measureMapBuffer(@NonNull() ReactContext context, @NonNull() String componentName, @NonNull() MapBuffer localData, @NonNull() MapBuffer props, @Nullable() MapBuffer state, float width, @NonNull() YogaMeasureMode widthMode, float height, @NonNull() YogaMeasureMode heightMode, @Nullable() Array<float> attachmentsPositions)
Measure a component, given localData, props, state, and measurement information. This needs toremain here for now - and not in SurfaceMountingManager - because sometimes measures are madeoutside of the context of a Surface; especially from C++ before StartSurface is called.
-
initializeViewManager
void initializeViewManager(String componentName)
-
-
-
-