ViewManager

Class responsible for knowing how to create and update catalyst Views of a given type. It is also responsible for creating and updating CSSNodeDEPRECATED subclasses used for calculating position and size for the corresponding native view.

Inheritors

Constructors

Link copied to clipboard
constructor()
constructor(@Nullable reactContext: ReactApplicationContext)

Properties

Link copied to clipboard
val METHOD_TYPE_ASYNC: String = "async"
Link copied to clipboard
val METHOD_TYPE_PROMISE: String = "promise"
Link copied to clipboard
val METHOD_TYPE_SYNC: String = "sync"

Functions

Link copied to clipboard
Return true if you intend to override some other native module that was registered e.g.
Link copied to clipboard
This method should return a subclass of ReactShadowNode which will be then used for measuring position and size of the view.
Link copied to clipboard
open fun createView(reactTag: Int, @NonNull reactContext: ThemedReactContext, @Nullable props: ReactStylesDiffMap, @Nullable stateWrapper: StateWrapper, jsResponderHandler: JSResponderHandler): T
Creates a view with knowledge of props and state.
Link copied to clipboard
open fun experimental_prefetchResource(reactContext: ReactContext, surfaceId: Int, reactTag: Int, params: MapBuffer)
THIS PREFETCH METHOD IS EXPERIMENTAL, DO NOT USE IT FOR PRODUCTION CODE, MOST LIKELY IT WILL CHANGE OR BE REMOVED IN THE FUTURE.
Link copied to clipboard
Subclasses of ViewManager that expect to receive commands through dispatchViewManagerCommand should override this method returning the map between names of the commands and IDs that are then used in receiveCommand method whenever the command is dispatched for this particular ViewManager.
Link copied to clipboard
Returns a map of config data passed to JS that defines eligible events that can be placed on native views.
Returns a map of config data passed to JS that defines eligible events that can be placed on native views.
Link copied to clipboard
Returns a map of view-specific constants that are injected to JavaScript.
Link copied to clipboard
abstract fun getName(): String
Link copied to clipboard
Returns a , representing the native props of the view manager.
Link copied to clipboard
abstract fun getShadowNodeClass(): Class<out C>
This method should return Class instance that represent type of shadow node that this manager will return from createShadowNodeInstance.
Link copied to clipboard
open fun initialize()
This method is called after ReactApplicationContext has been created.
Link copied to clipboard
open fun invalidate()
The CatalystInstance is going away with Venice.
Link copied to clipboard
open fun measure(context: Context, localData: ReadableMap, props: ReadableMap, state: ReadableMap, width: Float, widthMode: YogaMeasureMode, height: Float, heightMode: YogaMeasureMode, @Nullable attachmentsPositions: Array<Float>): Long
Subclasses can override this method to implement custom measure functions for the ViewManager
open fun measure(context: Context, localData: MapBuffer, props: MapBuffer, @Nullable state: MapBuffer, width: Float, widthMode: YogaMeasureMode, height: Float, heightMode: YogaMeasureMode, @Nullable attachmentsPositions: Array<Float>): Long
THIS MEASURE METHOD IS EXPERIMENTAL, MOST LIKELY YOU ARE LOOKING TO USE THE OTHER OVERLOAD INSTEAD: measureSubclasses can override this method to implement custom measure functions for the ViewManager
Link copied to clipboard
Allow NativeModule to clean up.
Link copied to clipboard
open fun onDropViewInstance(@NonNull view: T)
Called when view is detached from view hierarchy and allows for some additional cleanup by the ViewManager subclass.
Link copied to clipboard
open fun onSurfaceStopped(surfaceId: Int)
Lifecycle method: called when a surface is stopped.
Link copied to clipboard
open fun receiveCommand(@NonNull root: T, commandId: Int, @Nullable args: ReadableArray)
open fun receiveCommand(@NonNull root: T, commandId: String, @Nullable args: ReadableArray)
Subclasses may use this method to receive events/commands directly from JS through the .
Link copied to clipboard
open fun setPadding(view: T, left: Int, top: Int, right: Int, bottom: Int)
Subclasses can override this method to set padding for the given View in Fabric.
Link copied to clipboard
abstract fun updateExtraData(@NonNull root: T, extraData: Any)
Subclasses can implement this method to receive an optional extra data enqueued from the corresponding instance of ReactShadowNode in onCollectExtraUpdates.
Link copied to clipboard
open fun updateProperties(@NonNull viewToUpdate: T, props: ReactStylesDiffMap)
For the vast majority of ViewManagers, you will not need to override this.
Link copied to clipboard
open fun updateState(@NonNull view: T, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any
Subclasses can implement this method to receive state updates shared between all instances of this component type.