Package 

Class ReactProgressBarViewManager

  • All Implemented Interfaces:
    com.facebook.react.bridge.NativeModule , com.facebook.react.uimanager.BaseViewManagerInterface , com.facebook.react.viewmanagers.AndroidProgressBarManagerInterface

    
    public class ReactProgressBarViewManager
    extends BaseViewManager<ProgressBarContainerView, ProgressBarShadowNode> implements AndroidProgressBarManagerInterface<ProgressBarContainerView>
                        

    Manages instances of ProgressBar. ProgressBar is wrapped in a ProgressBarContainerView because the style of the ProgressBar can only be set in the constructor; whenever the style of a ProgressBar changes, we have to drop the existing ProgressBar (if there is one) and create a new one with the style given.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static String REACT_CLASS
    • Method Summary

      Modifier and Type Method Description
      static ProgressBar createProgressBar(Context context, int style) We create ProgressBars on both the UI and shadow threads.
      String getName()
      void setStyleAttr(ProgressBarContainerView view, @Nullable() String styleName)
      void setColor(ProgressBarContainerView view, @Nullable() Integer color)
      void setIndeterminate(ProgressBarContainerView view, boolean indeterminate)
      void setProgress(ProgressBarContainerView view, double progress)
      void setAnimating(ProgressBarContainerView view, boolean animating)
      void setTestID(ProgressBarContainerView view, @Nullable() String value)
      void setTypeAttr(ProgressBarContainerView view, @Nullable() String value)
      ProgressBarShadowNode createShadowNodeInstance() This method should return a subclass of ReactShadowNode which will be then used formeasuring position and size of the view.
      Class<ProgressBarShadowNode> getShadowNodeClass() This method should return Class instance that represent type of shadow node that thismanager will return from createShadowNodeInstance.
      void updateExtraData(ProgressBarContainerView root, Object extraData) Subclasses can implement this method to receive an optional extra data enqueued from thecorresponding instance of ReactShadowNode in .
      long measure(Context context, ReadableMap localData, ReadableMap props, ReadableMap state, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode, @Nullable() Array<float> attachmentsPositions) Subclasses can override this method to implement custom measure functions for the ViewManager
      • Methods inherited from class com.facebook.react.uimanager.BaseViewManager

        getExportedCustomBubblingEventTypeConstants, getExportedCustomDirectEventTypeConstants, setAccessibilityActions, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLabelledBy, setAccessibilityLiveRegion, setAccessibilityRole, setAccessibilityValue, setBackgroundColor, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderRadius, setBorderTopLeftRadius, setBorderTopRightRadius, setElevation, setImportantForAccessibility, setMoveShouldSetResponder, setMoveShouldSetResponderCapture, setNativeId, setOpacity, setPointerEnter, setPointerLeave, setPointerMove, setRenderToHardwareTexture, setResponderEnd, setResponderGrant, setResponderMove, setResponderReject, setResponderRelease, setResponderStart, setResponderTerminate, setResponderTerminationRequest, setRotation, setScaleX, setScaleY, setShadowColor, setShouldBlockNativeResponder, setStartShouldSetResponder, setStartShouldSetResponderCapture, setTestId, setTouchCancel, setTouchEnd, setTouchMove, setTouchStart, setTransform, setTranslateX, setTranslateY, setViewState, setZIndex
      • Methods inherited from class com.facebook.react.uimanager.ViewManager

        createShadowNodeInstance, createShadowNodeInstance, createView, getCommandsMap, getExportedViewConstants, getNativeProps, getShadowNodeClass, measure, onDropViewInstance, receiveCommand, receiveCommand, setPadding, updateExtraData, updateProperties, updateState
      • Methods inherited from class com.facebook.react.bridge.BaseJavaModule

        canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
      • Methods inherited from class com.facebook.react.uimanager.BaseViewManagerInterface

        setAccessibilityActions, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLabelledBy, setAccessibilityLiveRegion, setAccessibilityRole, setBackgroundColor, setElevation, setImportantForAccessibility, setNativeId, setOpacity, setRenderToHardwareTexture, setRotation, setScaleX, setScaleY, setShadowColor, setTestId, setTransform, setTranslateX, setTranslateY, setViewState, setZIndex
      • Methods inherited from class com.facebook.react.viewmanagers.AndroidProgressBarManagerInterface

        setAnimating, setColor, setIndeterminate, setProgress, setStyleAttr, setTestID, setTypeAttr
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReactProgressBarViewManager

        ReactProgressBarViewManager()
    • Method Detail

      • createProgressBar

         static ProgressBar createProgressBar(Context context, int style)

        We create ProgressBars on both the UI and shadow threads. There is a race condition in theProgressBar constructor that may cause crashes when two ProgressBars are constructed at thesame time on two different threads. This static ctor wrapper protects against that.

      • setIndeterminate

         void setIndeterminate(ProgressBarContainerView view, boolean indeterminate)
      • setProgress

         void setProgress(ProgressBarContainerView view, double progress)
      • setAnimating

         void setAnimating(ProgressBarContainerView view, boolean animating)
      • updateExtraData

         void updateExtraData(ProgressBarContainerView root, Object extraData)

        Subclasses can implement this method to receive an optional extra data enqueued from thecorresponding instance of ReactShadowNode in .

        Since css layout step and ui updates can be executed in separate thread apart of settingx/y/width/height this is the recommended and thread-safe way of passing extra data from cssnode to the native view counterpart.

        TODO T7247021: Replace updateExtraData with generic update props mechanism after D2086999

      • measure

         long measure(Context context, ReadableMap localData, ReadableMap props, ReadableMap state, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode, @Nullable() Array<float> attachmentsPositions)

        Subclasses can override this method to implement custom measure functions for the ViewManager

        Parameters:
        context - com.facebook.react.bridge.ReactContext used for the view.
        localData - ReadableMap containing "local data" defined in C++
        props - ReadableMap containing JS props
        state - ReadableMap containing state defined in C++
        width - width of the view (usually zero)
        widthMode - widthMode used during calculation of layout
        height - height of the view (usually zero)
        heightMode - widthMode used during calculation of layout
        attachmentsPositions - array containing 2x times the amount of attachmentsof the view.