-
public class SurfaceMountingManager
-
-
Constructor Summary
Constructors Constructor Description SurfaceMountingManager(int surfaceId, JSResponderHandler jsResponderHandler, ViewManagerRegistry viewManagerRegistry, RootViewManager rootViewManager, MountingManager.MountItemExecutor mountItemExecutor, ThemedReactContext reactContext)
-
Method Summary
Modifier and Type Method Description booleanisStopped()voidattachRootView(View rootView, ThemedReactContext themedReactContext)intgetSurfaceId()booleanisRootViewAttached()ThemedReactContextgetContext()booleangetViewExists(int tag)voidexecuteOnViewAttach(MountItem item)voidstopSurface()Stop surface and all operations within it. voidaddViewAt(int parentTag, int tag, int index)voidremoveViewAt(int tag, int parentTag, int index)voidcreateView(@NonNull() String componentName, int reactTag, @Nullable() Object props, @Nullable() StateWrapper stateWrapper, @Nullable() EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable)voidcreateViewUnsafe(@NonNull() String componentName, int reactTag, @Nullable() Object props, @Nullable() StateWrapper stateWrapper, @Nullable() EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable)Perform view creation without any safety checks. voidupdateProps(int reactTag, Object props)voidreceiveCommand(int reactTag, int commandId, @Nullable() ReadableArray commandArgs)voidreceiveCommand(int reactTag, @NonNull() String commandId, @Nullable() ReadableArray commandArgs)voidsendAccessibilityEvent(int reactTag, int eventType)voidupdateLayout(int reactTag, int x, int y, int width, int height, int displayType)voidupdatePadding(int reactTag, int left, int top, int right, int bottom)voidupdateOverflowInset(int reactTag, int overflowInsetLeft, int overflowInsetTop, int overflowInsetRight, int overflowInsetBottom)voidupdateState(int reactTag, @Nullable() StateWrapper stateWrapper)voidupdateEventEmitter(int reactTag, @NonNull() EventEmitterWrapper eventEmitter)synchronized voidsetJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder)voiddidUpdateViews()voiddeleteView(int reactTag)voidpreallocateView(String componentName, int reactTag, @Nullable() Object props, @Nullable() StateWrapper stateWrapper, @Nullable() EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable)EventEmitterWrappergetEventEmitter(int reactTag)ViewgetView(int reactTag)voidprintSurfaceState()-
-
Constructor Detail
-
SurfaceMountingManager
SurfaceMountingManager(int surfaceId, JSResponderHandler jsResponderHandler, ViewManagerRegistry viewManagerRegistry, RootViewManager rootViewManager, MountingManager.MountItemExecutor mountItemExecutor, ThemedReactContext reactContext)
-
-
Method Detail
-
isStopped
boolean isStopped()
-
attachRootView
void attachRootView(View rootView, ThemedReactContext themedReactContext)
-
getSurfaceId
int getSurfaceId()
-
isRootViewAttached
boolean isRootViewAttached()
-
getContext
@Nullable() ThemedReactContext getContext()
-
getViewExists
boolean getViewExists(int tag)
-
executeOnViewAttach
@AnyThread() void executeOnViewAttach(MountItem item)
-
stopSurface
@AnyThread() void stopSurface()
Stop surface and all operations within it. Garbage-collect Views (caller is responsible forremoving RootView from View layer).
Delete rootView from cache. Since RN does not control the RootView, in a sense, the fragmentis responsible for actually removing the RootView from the hierarchy / tearing down thefragment.
In the original version(s) of this function, we recursively went through all children of theView and dropped those Views as well; ad infinitum. This was before we had aSurfaceMountingManager, and all tags were in one global map. Doing this was particularlyimportant in the case of StopSurface, where race conditions between threads meant you couldn'trely on DELETE instructions actually deleting all Views in the Surface.
Now that we have SurfaceMountingManager, we can simply drop our local reference to the View.Since it will be removed from the View hierarchy entirely (outside of the scope of this class),garbage collection will take care of destroying it and all descendents.
-
removeViewAt
@UiThread() void removeViewAt(int tag, int parentTag, int index)
-
createView
@UiThread() void createView(@NonNull() String componentName, int reactTag, @Nullable() Object props, @Nullable() StateWrapper stateWrapper, @Nullable() EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable)
-
createViewUnsafe
@UiThread() void createViewUnsafe(@NonNull() String componentName, int reactTag, @Nullable() Object props, @Nullable() StateWrapper stateWrapper, @Nullable() EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable)
Perform view creation without any safety checks. You must ensure safety before calling thismethod (see existing callsites).
-
updateProps
void updateProps(int reactTag, Object props)
-
receiveCommand
@Deprecated() void receiveCommand(int reactTag, int commandId, @Nullable() ReadableArray commandArgs)
-
receiveCommand
void receiveCommand(int reactTag, @NonNull() String commandId, @Nullable() ReadableArray commandArgs)
-
sendAccessibilityEvent
void sendAccessibilityEvent(int reactTag, int eventType)
-
updateLayout
@UiThread() void updateLayout(int reactTag, int x, int y, int width, int height, int displayType)
-
updatePadding
@UiThread() void updatePadding(int reactTag, int left, int top, int right, int bottom)
-
updateOverflowInset
@UiThread() void updateOverflowInset(int reactTag, int overflowInsetLeft, int overflowInsetTop, int overflowInsetRight, int overflowInsetBottom)
-
updateState
@UiThread() void updateState(int reactTag, @Nullable() StateWrapper stateWrapper)
-
updateEventEmitter
@UiThread() void updateEventEmitter(int reactTag, @NonNull() EventEmitterWrapper eventEmitter)
-
setJSResponder
@UiThread() synchronized void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder)
-
didUpdateViews
@UiThread() void didUpdateViews()
-
deleteView
@UiThread() void deleteView(int reactTag)
-
preallocateView
@UiThread() void preallocateView(String componentName, int reactTag, @Nullable() Object props, @Nullable() StateWrapper stateWrapper, @Nullable() EventEmitterWrapper eventEmitterWrapper, boolean isLayoutable)
-
getEventEmitter
@AnyThread()@Nullable() EventEmitterWrapper getEventEmitter(int reactTag)
-
printSurfaceState
void printSurfaceState()
-
-
-
-