public class UIImplementation
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
UIImplementation.LayoutUpdateListener
Interface definition for a callback to be invoked when the layout has been updated
|
Modifier and Type | Field and Description |
---|---|
protected EventDispatcher |
mEventDispatcher |
protected UIImplementation.LayoutUpdateListener |
mLayoutUpdateListener |
protected ReactApplicationContext |
mReactContext |
protected ShadowNodeRegistry |
mShadowNodeRegistry |
Modifier | Constructor and Description |
---|---|
|
UIImplementation(ReactApplicationContext reactContext,
java.util.List<ViewManager> viewManagers,
EventDispatcher eventDispatcher,
int minTimeLeftInFrameForNonBatchedOperationMs) |
|
UIImplementation(ReactApplicationContext reactContext,
UIManagerModule.ViewManagerResolver viewManagerResolver,
EventDispatcher eventDispatcher,
int minTimeLeftInFrameForNonBatchedOperationMs) |
protected |
UIImplementation(ReactApplicationContext reactContext,
ViewManagerRegistry viewManagers,
UIViewOperationQueue operationsQueue,
EventDispatcher eventDispatcher) |
Modifier and Type | Method and Description |
---|---|
void |
addAnimation(int reactTag,
int animationID,
Callback onSuccess)
Adds an Animation previously registered with
registerAnimation(com.facebook.react.animation.Animation) to a View and starts it |
void |
addUIBlock(UIBlock block) |
protected void |
applyUpdatesRecursive(ReactShadowNode cssNode,
float absoluteX,
float absoluteY) |
protected void |
calculateRootLayout(ReactShadowNode cssRoot) |
void |
clearJSResponder() |
void |
configureNextLayoutAnimation(ReadableMap config,
Callback success,
Callback error)
Configure an animation to be used for the native layout changes, and native views
creation.
|
protected ReactShadowNode |
createRootShadowNode() |
protected ReactShadowNode |
createShadowNode(java.lang.String className) |
void |
createView(int tag,
java.lang.String className,
int rootViewTag,
ReadableMap props)
Invoked by React to create a new node with a given tag, class name and properties.
|
void |
dismissPopupMenu() |
void |
dispatchViewManagerCommand(int reactTag,
int commandId,
ReadableArray commandArgs) |
void |
dispatchViewUpdates(int batchId)
Invoked at the end of the transaction to commit any updates to the node hierarchy.
|
void |
enableLayoutCalculationForRootNode(int rootViewTag)
Enables Layout calculation for a Root node that has been measured.
|
void |
findSubviewIn(int reactTag,
float targetX,
float targetY,
Callback callback)
Find the touch target child native view in the supplied root view hierarchy, given a react
target location.
|
java.util.Map<java.lang.String,java.lang.Long> |
getProfiledBatchPerfCounters() |
protected void |
handleCreateView(ReactShadowNode cssNode,
int rootViewTag,
ReactStylesDiffMap styles) |
protected void |
handleUpdateView(ReactShadowNode cssNode,
java.lang.String className,
ReactStylesDiffMap styles) |
void |
manageChildren(int viewTag,
ReadableArray moveFrom,
ReadableArray moveTo,
ReadableArray addChildTags,
ReadableArray addAtIndices,
ReadableArray removeFrom)
Invoked when there is a mutation in a node tree.
|
void |
measure(int reactTag,
Callback callback)
Determines the location on screen, width, and height of the given view relative to the root
view and returns the values via an async callback.
|
void |
measureInWindow(int reactTag,
Callback callback)
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.
|
void |
measureLayout(int tag,
int ancestorTag,
Callback errorCallback,
Callback successCallback)
Measures the view specified by tag relative to the given ancestorTag.
|
void |
measureLayoutRelativeToParent(int tag,
Callback errorCallback,
Callback successCallback)
Like
measure(int, com.facebook.react.bridge.Callback) and measureLayout(int, int, com.facebook.react.bridge.Callback, com.facebook.react.bridge.Callback) but measures relative to the immediate parent. |
void |
onHostDestroy() |
void |
onHostPause() |
void |
onHostResume() |
void |
prependUIBlock(UIBlock block) |
void |
profileNextBatch() |
void |
registerAnimation(Animation animation)
Registers a new Animation that can then be added to a View using
addAnimation(int, int, com.facebook.react.bridge.Callback) . |
<T extends SizeMonitoringFrameLayout & MeasureSpecProvider> |
registerRootView(T rootView,
int tag,
ThemedReactContext context)
Registers a root node with a given tag, size and ThemedReactContext and adds it to a node
registry.
|
void |
removeAnimation(int reactTag,
int animationID)
Removes an existing Animation, canceling it if it was in progress.
|
void |
removeLayoutUpdateListener() |
void |
removeRootShadowNode(int rootViewTag)
Unregisters a root node with a given tag from the shadow node registry
|
void |
removeRootView(int rootViewTag)
Unregisters a root node with a given tag.
|
protected void |
removeShadowNode(ReactShadowNode nodeToRemove) |
void |
removeSubviewsFromContainerWithID(int containerTag)
Method which takes a container tag and then releases all subviews for that container upon
receipt.
|
void |
replaceExistingNonRootView(int oldTag,
int newTag)
Replaces the View specified by oldTag with the View specified by newTag within oldTag's parent.
|
int |
resolveRootTagFromReactTag(int reactTag) |
ReactShadowNode |
resolveShadowNode(int reactTag) |
protected ViewManager |
resolveViewManager(java.lang.String className) |
void |
sendAccessibilityEvent(int tag,
int eventType) |
void |
setChildren(int viewTag,
ReadableArray childrenTags)
An optimized version of manageChildren that is used for initial setting of child views.
|
void |
setJSResponder(int reactTag,
boolean blockNativeResponder) |
void |
setLayoutAnimationEnabledExperimental(boolean enabled)
LayoutAnimation API on Android is currently experimental.
|
void |
setLayoutUpdateListener(UIImplementation.LayoutUpdateListener listener) |
void |
setViewHierarchyUpdateDebugListener(NotThreadSafeViewHierarchyUpdateDebugListener listener) |
void |
setViewLocalData(int tag,
java.lang.Object data) |
void |
showPopupMenu(int reactTag,
ReadableArray items,
Callback error,
Callback success)
Show a PopupMenu.
|
void |
synchronouslyUpdateViewOnUIThread(int tag,
ReactStylesDiffMap props)
Used by native animated module to bypass the process of updating the values through the shadow
view hierarchy.
|
void |
updateNodeSize(int nodeViewTag,
int newWidth,
int newHeight)
Invoked when native view that corresponds to a root node, or acts as a root view (ie.
|
void |
updateRootView(int tag,
int widthMeasureSpec,
int heightMeasureSpec)
Updates the styles of the
ReactShadowNode based on the Measure specs received by
parameters. |
void |
updateRootView(ReactShadowNode rootCSSNode,
int widthMeasureSpec,
int heightMeasureSpec)
Updates the styles of the
ReactShadowNode based on the Measure specs received by
parameters. |
void |
updateView(int tag,
java.lang.String className,
ReadableMap props)
Invoked by React to create a new node with a given tag has its properties changed.
|
protected void |
updateViewHierarchy() |
void |
viewIsDescendantOf(int reactTag,
int ancestorReactTag,
Callback callback)
Check if the first shadow node is the descendant of the second shadow node
|
protected final EventDispatcher mEventDispatcher
protected final ReactApplicationContext mReactContext
protected final ShadowNodeRegistry mShadowNodeRegistry
@Nullable protected UIImplementation.LayoutUpdateListener mLayoutUpdateListener
public UIImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs)
public UIImplementation(ReactApplicationContext reactContext, java.util.List<ViewManager> viewManagers, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs)
protected UIImplementation(ReactApplicationContext reactContext, ViewManagerRegistry viewManagers, UIViewOperationQueue operationsQueue, EventDispatcher eventDispatcher)
protected ReactShadowNode createRootShadowNode()
protected ReactShadowNode createShadowNode(java.lang.String className)
public final ReactShadowNode resolveShadowNode(int reactTag)
protected final ViewManager resolveViewManager(java.lang.String className)
public void updateRootView(int tag, int widthMeasureSpec, int heightMeasureSpec)
ReactShadowNode
based on the Measure specs received by
parameters.public void updateRootView(ReactShadowNode rootCSSNode, int widthMeasureSpec, int heightMeasureSpec)
ReactShadowNode
based on the Measure specs received by
parameters.public <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> void registerRootView(T rootView, int tag, ThemedReactContext context)
public void removeRootView(int rootViewTag)
public void removeRootShadowNode(int rootViewTag)
public void updateNodeSize(int nodeViewTag, int newWidth, int newHeight)
public void setViewLocalData(int tag, java.lang.Object data)
public void profileNextBatch()
public java.util.Map<java.lang.String,java.lang.Long> getProfiledBatchPerfCounters()
public void createView(int tag, java.lang.String className, int rootViewTag, ReadableMap props)
protected void handleCreateView(ReactShadowNode cssNode, int rootViewTag, @Nullable ReactStylesDiffMap styles)
public void updateView(int tag, java.lang.String className, ReadableMap props)
public void synchronouslyUpdateViewOnUIThread(int tag, ReactStylesDiffMap props)
protected void handleUpdateView(ReactShadowNode cssNode, java.lang.String className, ReactStylesDiffMap styles)
public void manageChildren(int viewTag, @Nullable ReadableArray moveFrom, @Nullable ReadableArray moveTo, @Nullable ReadableArray addChildTags, @Nullable ReadableArray addAtIndices, @Nullable ReadableArray removeFrom)
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 represent
a view which should be added at the specified indextagsToDelete
- list of tags corresponding to views that should be removedpublic void setChildren(int viewTag, ReadableArray childrenTags)
viewTag
- tag of the parentchildrenTags
- tags of the childrenpublic void replaceExistingNonRootView(int oldTag, int newTag)
public void removeSubviewsFromContainerWithID(int containerTag)
containerTag
- the tag of the container for which the subviews must be removedpublic void findSubviewIn(int reactTag, float targetX, float targetY, Callback callback)
reactTag
- the tag of the root view to traversetargetX
- target X locationtargetY
- target Y locationcallback
- will be called if with the identified child view react ID, and measurement
info. If no view was found, callback will be invoked with no data.public void viewIsDescendantOf(int reactTag, int ancestorReactTag, Callback callback)
public void measure(int reactTag, Callback callback)
public void measureInWindow(int reactTag, Callback callback)
public void measureLayout(int tag, int ancestorTag, Callback errorCallback, Callback successCallback)
public void measureLayoutRelativeToParent(int tag, Callback errorCallback, Callback successCallback)
measure(int, com.facebook.react.bridge.Callback)
and measureLayout(int, int, com.facebook.react.bridge.Callback, com.facebook.react.bridge.Callback)
but measures relative to the immediate parent.public void dispatchViewUpdates(int batchId)
protected void updateViewHierarchy()
public void registerAnimation(Animation animation)
addAnimation(int, int, com.facebook.react.bridge.Callback)
.public void addAnimation(int reactTag, int animationID, Callback onSuccess)
registerAnimation(com.facebook.react.animation.Animation)
to a View and starts itpublic void removeAnimation(int reactTag, int animationID)
public void setLayoutAnimationEnabledExperimental(boolean enabled)
enabled
- whether layout animation is enabled or notpublic void configureNextLayoutAnimation(ReadableMap config, Callback success, Callback error)
config
- the configuration of the animation for view addition/removal/update.success
- will be called when the animation completes, or when the animation get
interrupted. In this case, callback parameter will be false.error
- will be called if there was an error processing the animationpublic void setJSResponder(int reactTag, boolean blockNativeResponder)
public void clearJSResponder()
public void dispatchViewManagerCommand(int reactTag, int commandId, @Nullable ReadableArray commandArgs)
public void showPopupMenu(int reactTag, ReadableArray items, Callback error, Callback success)
reactTag
- the tag of the anchor view (the PopupMenu is displayed next to this view); this
needs to be the tag of a native view (shadow views can not be anchors)items
- the menu items as an array of stringserror
- will be called if there is an error displaying the menusuccess
- will be called with the position of the selected item as the first argument, or
no arguments if the menu is dismissedpublic void dismissPopupMenu()
public void sendAccessibilityEvent(int tag, int eventType)
public void onHostResume()
public void onHostPause()
public void onHostDestroy()
public void setViewHierarchyUpdateDebugListener(@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener)
protected final void removeShadowNode(ReactShadowNode nodeToRemove)
protected void calculateRootLayout(ReactShadowNode cssRoot)
protected void applyUpdatesRecursive(ReactShadowNode cssNode, float absoluteX, float absoluteY)
public void addUIBlock(UIBlock block)
public void prependUIBlock(UIBlock block)
public int resolveRootTagFromReactTag(int reactTag)
public void enableLayoutCalculationForRootNode(int rootViewTag)
rootViewTag
- int
Tag of the root nodepublic void setLayoutUpdateListener(UIImplementation.LayoutUpdateListener listener)
public void removeLayoutUpdateListener()