-
@NotThreadSafe() public class NativeViewHierarchyManagerDelegate of UIManagerModule that owns the native view hierarchy and mapping between native view names used in JS and corresponding instances of ViewManager. The communicates with this class by it's public interface methods:
- updateProperties
- updateLayout
- createView
- manageChildren
NB: All native view management methods listed above must be called from the UI thread.
The ReactContext instance that is passed to views that this manager creates differs from the one that we pass as a constructor. Instead we wrap the provided instance of in an instance of ThemedReactContext that additionally provide a correct theme based on the root view for a view tree that we attach newly created view to. Therefore this view manager will create a copy of ThemedReactContext that wraps the instance of for each root view added to the manager (see addRootView).
TODO(5483031): Only dispatch updates when shadow views have changed
-
-
Constructor Summary
Constructors Constructor Description NativeViewHierarchyManager(ViewManagerRegistry viewManagers)NativeViewHierarchyManager(ViewManagerRegistry viewManagers, RootViewManager manager)
-
Method Summary
Modifier and Type Method Description final synchronized ViewresolveView(int tag)final synchronized ViewManagerresolveViewManager(int tag)voidsetLayoutAnimationEnabled(boolean enabled)synchronized voidupdateInstanceHandle(int tag, long instanceHandle)synchronized voidupdateProperties(int tag, ReactStylesDiffMap props)synchronized voidupdateViewExtraData(int tag, Object extraData)synchronized voidupdateLayout(int parentTag, int tag, int x, int y, int width, int height)longgetInstanceHandle(int reactTag)synchronized voidcreateView(ThemedReactContext themedContext, int tag, String className, @Nullable() ReactStylesDiffMap initialProps)synchronized voidmanageChildren(int tag, @Nullable() Array<int> indicesToRemove, @Nullable() Array<ViewAtIndex> viewsToAdd, @Nullable() Array<int> tagsToDelete)synchronized voidsetChildren(int tag, ReadableArray childrenTags)Simplified version of manageChildren that only deals with adding children views synchronized voidaddRootView(int tag, View view)See addRootView. synchronized voidremoveRootView(int rootViewTag)synchronized voidmeasure(int tag, Array<int> outputBuffer)Returns true on success, false on failure. synchronized voidmeasureInWindow(int tag, Array<int> outputBuffer)Returns the coordinates of a view relative to the window (not just the RootView which is whatmeasure will return) synchronized intfindTargetTagForTouch(int reactTag, float touchX, float touchY)synchronized voidsetJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder)voidclearJSResponder()synchronized voiddispatchCommand(int reactTag, int commandId, @Nullable() ReadableArray args)synchronized voiddispatchCommand(int reactTag, String commandId, @Nullable() ReadableArray args)synchronized voidshowPopupMenu(int reactTag, ReadableArray items, Callback success, Callback error)Show a PopupMenu. voiddismissPopupMenu()Dismiss the last opened PopupMenu PopupMenu. voidsendAccessibilityEvent(int tag, int eventType)-
-
Constructor Detail
-
NativeViewHierarchyManager
NativeViewHierarchyManager(ViewManagerRegistry viewManagers)
-
NativeViewHierarchyManager
NativeViewHierarchyManager(ViewManagerRegistry viewManagers, RootViewManager manager)
-
-
Method Detail
-
resolveView
final synchronized View resolveView(int tag)
-
resolveViewManager
final synchronized ViewManager resolveViewManager(int tag)
-
setLayoutAnimationEnabled
void setLayoutAnimationEnabled(boolean enabled)
-
updateInstanceHandle
synchronized void updateInstanceHandle(int tag, long instanceHandle)
-
updateProperties
synchronized void updateProperties(int tag, ReactStylesDiffMap props)
-
updateViewExtraData
synchronized void updateViewExtraData(int tag, Object extraData)
-
updateLayout
synchronized void updateLayout(int parentTag, int tag, int x, int y, int width, int height)
-
getInstanceHandle
@Nullable() long getInstanceHandle(int reactTag)
-
createView
synchronized void createView(ThemedReactContext themedContext, int tag, String className, @Nullable() ReactStylesDiffMap initialProps)
-
manageChildren
synchronized void manageChildren(int tag, @Nullable() Array<int> indicesToRemove, @Nullable() Array<ViewAtIndex> viewsToAdd, @Nullable() Array<int> tagsToDelete)
- Parameters:
tag- react tag of the node we want to manageindicesToRemove- ordered (asc) list of indicies at which view should be removedviewsToAdd- ordered (asc based on mIndex property) list of tag-index pairs that representa view which should be added at the specified indextagsToDelete- list of tags corresponding to views that should be removed
-
setChildren
synchronized void setChildren(int tag, ReadableArray childrenTags)
Simplified version of manageChildren that only deals with adding children views
-
addRootView
synchronized void addRootView(int tag, View view)
See addRootView.
-
removeRootView
synchronized void removeRootView(int rootViewTag)
-
measure
synchronized void measure(int tag, Array<int> outputBuffer)
Returns true on success, false on failure. If successful, after calling, output buffer will be {x, y, width, height}.
-
measureInWindow
synchronized void measureInWindow(int tag, Array<int> outputBuffer)
Returns the coordinates of a view relative to the window (not just the RootView which is whatmeasure will return)
- Parameters:
tag- - the tag for the viewoutputBuffer- - output buffer that contains [x,y,width,height] of the view in coordinatesrelative to the device window
-
findTargetTagForTouch
synchronized int findTargetTagForTouch(int reactTag, float touchX, float touchY)
-
setJSResponder
synchronized void setJSResponder(int reactTag, int initialReactTag, boolean blockNativeResponder)
-
clearJSResponder
void clearJSResponder()
-
dispatchCommand
@Deprecated() synchronized void dispatchCommand(int reactTag, int commandId, @Nullable() ReadableArray args)
-
dispatchCommand
synchronized void dispatchCommand(int reactTag, String commandId, @Nullable() ReadableArray args)
-
showPopupMenu
synchronized void showPopupMenu(int reactTag, ReadableArray items, Callback success, Callback error)
Show a PopupMenu.
- Parameters:
reactTag- the tag of the anchor view (the PopupMenu is displayed next to this view); thisneeds to be the tag of a native view (shadow views can not be anchors)items- the menu items as an array of stringssuccess- will be called with the position of the selected item as the first argument, orno arguments if the menu is dismissed
-
dismissPopupMenu
void dismissPopupMenu()
Dismiss the last opened PopupMenu PopupMenu.
-
sendAccessibilityEvent
void sendAccessibilityEvent(int tag, int eventType)
-
-
-
-