Package 

Class UIImplementation


  • 
    public class UIImplementation
    
                        

    A class that is used to receive React commands from JS and translate them into a shadow node hierarchy that is then mapped to a native view hierarchy.

    • Method Detail

      • updateRootView

         void updateRootView(int tag, int widthMeasureSpec, int heightMeasureSpec)

        Updates the styles of the ReactShadowNode based on the Measure specs received byparameters.

      • registerRootView

         <T extends View> void registerRootView(T rootView, int tag, ThemedReactContext context)

        Registers a root node with a given tag, size and ThemedReactContext and adds it to a noderegistry.

      • removeRootView

         void removeRootView(int rootViewTag)

        Unregisters a root node with a given tag.

      • removeRootShadowNode

         void removeRootShadowNode(int rootViewTag)

        Unregisters a root node with a given tag from the shadow node registry

      • updateNodeSize

         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. Modals)has its size changed.

      • createView

         void createView(int tag, String className, int rootViewTag, ReadableMap props)

        Invoked by React to create a new node with a given tag, class name and properties.

      • updateView

         void updateView(int tag, String className, ReadableMap props)

        Invoked by React to create a new node with a given tag has its properties changed.

      • synchronouslyUpdateViewOnUIThread

         void synchronouslyUpdateViewOnUIThread(int tag, ReactStylesDiffMap props)

        Used by native animated module to bypass the process of updating the values through the shadowview hierarchy. This method will directly update native views, which means that updates forlayout-related propertied won't be handled properly. Make sure you know what you're doingbefore calling this method :)

      • setChildren

         void setChildren(int viewTag, ReadableArray childrenTags)

        An optimized version of manageChildren that is used for initial setting of child views. Thechildren are assumed to be in index order

        Parameters:
        viewTag - tag of the parent
        childrenTags - tags of the children
      • replaceExistingNonRootView

         void replaceExistingNonRootView(int oldTag, int newTag)

        Replaces the View specified by oldTag with the View specified by newTag within oldTag's parent.

      • removeSubviewsFromContainerWithID

         void removeSubviewsFromContainerWithID(int containerTag)

        Method which takes a container tag and then releases all subviews for that container uponreceipt. TODO: The method name is incorrect and will be renamed, #6033872

        Parameters:
        containerTag - the tag of the container for which the subviews must be removed
      • findSubviewIn

         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 reacttarget location.

        This method is currently used only by Element Inspector DevTool.

        Parameters:
        reactTag - the tag of the root view to traverse
        targetX - target X location
        targetY - target Y location
        callback - will be called if with the identified child view react ID, and measurementinfo.
      • viewIsDescendantOf

        @Deprecated() void viewIsDescendantOf(int reactTag, int ancestorReactTag, Callback callback)

        Check if the first shadow node is the descendant of the second shadow node

      • measure

         void measure(int reactTag, Callback callback)

        Determines the location on screen, width, and height of the given view relative to the rootview and returns the values via an async callback.

      • measureInWindow

         void measureInWindow(int reactTag, Callback callback)

        Determines the location on screen, width, and height of the given view relative to the devicescreen and returns the values via an async callback. This is the absolute position includingthings like the status bar

      • measureLayout

         void measureLayout(int tag, int ancestorTag, Callback errorCallback, Callback successCallback)

        Measures the view specified by tag relative to the given ancestorTag. This means that thereturned x, y are relative to the origin x, y of the ancestor view. Results are stored in thegiven outputBuffer. We allow ancestor view and measured view to be the same, in which case theposition always will be (0, 0) and method will only measure the view dimensions.

      • dispatchViewUpdates

         void dispatchViewUpdates(int batchId)

        Invoked at the end of the transaction to commit any updates to the node hierarchy.

      • setLayoutAnimationEnabledExperimental

         void setLayoutAnimationEnabledExperimental(boolean enabled)

        LayoutAnimation API on Android is currently experimental. Therefore, it needs to be enabledexplicitly in order to avoid regression in existing application written for iOS using this API.

        Warning : This method will be removed in future version of React Native, and layoutanimation will be enabled by default, so always check for its existence before invoking it.

        TODO(9139831) : remove this method once layout animation is fully stable.

        Parameters:
        enabled - whether layout animation is enabled or not
      • configureNextLayoutAnimation

         void configureNextLayoutAnimation(ReadableMap config, Callback success)

        Configure an animation to be used for the native layout changes, and native views creation. Theanimation will only apply during the current batch operations.

        TODO(7728153) : animating view deletion is currently not supported. TODO(7613721) :callbacks are not supported, this feature will likely be killed.

        Parameters:
        config - the configuration of the animation for view addition/removal/update.
        success - will be called when the animation completes, or when the animation getinterrupted.
      • setJSResponder

         void setJSResponder(int reactTag, boolean blockNativeResponder)
      • showPopupMenu

         void showPopupMenu(int reactTag, ReadableArray items, Callback error, Callback success)

        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 strings
        error - will be called if there is an error displaying the menu
        success - will be called with the position of the selected item as the first argument, orno arguments if the menu is dismissed