UIManager Module
open class UIManagerModule : ReactContextBaseJavaModule, OnBatchCompleteListener, LifecycleEventListener, UIManager
Native module to allow JS to create and update native Views.
== Transactional Requirement ==
A requirement of this class is to make sure that transactional UI updates occur all at once, meaning that no intermediate state is ever rendered to the screen. For example, if a JS application update changes the background of View A to blue and the width of View B to 100, both need to appear at once. Practically, this means that all UI update code related to a single transaction must be executed as a single code block on the UI thread. Executing as multiple code blocks could allow the platform UI system to interrupt and render a partial UI state.To facilitate this, this module enqueues operations that are then applied to native view hierarchy through NativeViewHierarchyManager at the end of each transaction.
== CSSNodes ==
In order to allow layout and measurement to occur on a non-UI thread, this module also operates on intermediate CSSNodeDEPRECATED objects that correspond to a native view. These CSSNodeDEPRECATED are able to calculate layout according to their styling rules, and then the resulting x/y/width/height of that layout is scheduled as an operation that will be applied to native view hierarchy at the end of current batch. TODO(5241856): Investigate memory usage of creating many small objects in UIManageModule and consider implementing a pool TODO(5483063): Don't dispatch the view hierarchy at the end of a batch if no UI changes occurredConstructors
Link copied to clipboard
constructor(reactContext: ReactApplicationContext, viewManagerResolver: ViewManagerResolver, minTimeLeftInFrameForNonBatchedOperationMs: Int)
constructor(reactContext: ReactApplicationContext, viewManagersList: List<ViewManager>, minTimeLeftInFrameForNonBatchedOperationMs: Int)
Types
Link copied to clipboard
interface CustomEventNamesResolver
Resolves a name coming from native side to a name of the event that is exposed to JS.
Functions
Link copied to clipboard
Registers a new root view.
Link copied to clipboard
Schedule a block to be executed on the UI thread.
Link copied to clipboard
Register a UIManagerListener with this UIManager to receive lifecycle callbacks.
Link copied to clipboard
Link copied to clipboard
Return true if you intend to override some other native module that was registered e.g.
Link copied to clipboard
Link copied to clipboard
Configure an animation to be used for the native layout changes, and native views creation.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Deprecated, use dispatchCommand instead.
Dispatches the commandId received by parameter to the view associated with the reactTag.
Link copied to clipboard
open fun dispatchViewManagerCommand(reactTag: Int, commandId: Dynamic, @Nullable commandArgs: ReadableArray)
Link copied to clipboard
Find the touch target child native view in the supplied root view hierarchy, given a react target location.
Link copied to clipboard
Link copied to clipboard
open fun getConstantsForViewManager(viewManager: ViewManager, customDirectEvents: Map<String, Any>): WritableMap
Link copied to clipboard
Link copied to clipboard
Resolves Direct Event name exposed to JS from the one known to the Native side.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
This method gives an access to the UIImplementation object that can be used to execute operations on the view hierarchy.
Link copied to clipboard
This method is intended to reuse the ViewManagerRegistry with FabricUIManager.
Link copied to clipboard
This method is called after ReactApplicationContext has been created.
Link copied to clipboard
The CatalystInstance is going away with Venice.
Link copied to clipboard
Dirties the node associated with the given react tag
Link copied to clipboard
open fun manageChildren(viewTag: Int, @Nullable moveFrom: ReadableArray, @Nullable moveTo: ReadableArray, @Nullable addChildTags: ReadableArray, @Nullable addAtIndices: ReadableArray, @Nullable removeFrom: ReadableArray)
Interface for adding/removing/moving views within a parent view from JS.
Link copied to clipboard
Mark a view as currently active for a touch event.
Link copied to clipboard
Determines the location on screen, width, and height of the given view relative to the device screen and returns the values via an async callback.
Link copied to clipboard
open fun measureLayout(tag: Int, ancestorTag: Int, errorCallback: Callback, successCallback: Callback)
Measures the view specified by tag relative to the given ancestorTag.
Link copied to clipboard
To implement the transactional requirement mentioned in the class javadoc, we only commit UI changes to the actual view hierarchy once a batch of JS->Java calls have been completed.
Link copied to clipboard
Allow NativeModule to clean up.
Link copied to clipboard
Called when host activity receives destroy event (e.g.
Link copied to clipboard
Called when host activity receives pause event (e.g.
Link copied to clipboard
Called either when the host activity receives a resume event (e.g.
Link copied to clipboard
Schedule a block to be executed on the UI thread.
Link copied to clipboard
Link copied to clipboard
open fun receiveEvent(surfaceId: Int, reactTag: Int, eventName: String, @Nullable event: WritableMap)
This method dispatches events from RN Android code to JS.
Link copied to clipboard
Unregisters a new root view.
Link copied to clipboard
Unregister a UIManagerListener from this UIManager to stop receiving lifecycle callbacks.
Link copied to clipboard
Link copied to clipboard
Resolves Direct Event name exposed to JS from the one known to the Native side.
Link copied to clipboard
Given a reactTag from a component, find its root node tag, if possible.
Link copied to clipboard
Resolves a view based on its reactTag.
Link copied to clipboard
Dispatch an accessibility event to a view asynchronously.
Link copied to clipboard
Interface for fast tracking the initial adding of views.
Link copied to clipboard
Link copied to clipboard
LayoutAnimation API on Android is currently experimental.
Link copied to clipboard
open fun setViewHierarchyUpdateDebugListener(@Nullable listener: NotThreadSafeViewHierarchyUpdateDebugListener)
Link copied to clipboard
Sets local data for a shadow node corresponded with given tag.
Link copied to clipboard
open fun <T : View?> startSurface(rootView: T, moduleName: String, initialProps: WritableMap, widthMeasureSpec: Int, heightMeasureSpec: Int): Int
Registers a new root view with width and height.
Link copied to clipboard
Stop a surface from running in JS and clears up native memory usage.
Link copied to clipboard
Sweep a view as currently not active for a touch event.
Link copied to clipboard
Used by native animated module to bypass the process of updating the values through the shadow view hierarchy.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun updateRootLayoutSpecs(rootViewTag: Int, widthMeasureSpec: Int, heightMeasureSpec: Int, offsetX: Int, offsetY: Int)
Updates the styles of the ReactShadowNode based on the Measure specs received by parameters.
Link copied to clipboard
Link copied to clipboard
Check if the first shadow node is the descendant of the second shadow node