-
- 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
-
Constructor Summary
Constructors Constructor Description ReactProgressBarViewManager()
-
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
-
-
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.
-
setStyleAttr
void setStyleAttr(ProgressBarContainerView view, @Nullable() String styleName)
-
setIndeterminate
void setIndeterminate(ProgressBarContainerView view, boolean indeterminate)
-
setProgress
void setProgress(ProgressBarContainerView view, double progress)
-
setAnimating
void setAnimating(ProgressBarContainerView view, boolean animating)
-
setTypeAttr
void setTypeAttr(ProgressBarContainerView view, @Nullable() String value)
-
createShadowNodeInstance
ProgressBarShadowNode createShadowNodeInstance()
This method should return a subclass of ReactShadowNode which will be then used formeasuring position and size of the view. In most of the cases this should just return aninstance of ReactShadowNode
-
getShadowNodeClass
Class<ProgressBarShadowNode> getShadowNodeClass()
This method should return Class instance that represent type of shadow node that thismanager will return from createShadowNodeInstance.
This method will be used in the bridge initialization phase to collect properties exposedusing ReactProp (or ReactPropGroup) annotation from the ReactShadowNode subclass specific for native view this manager provides.
-
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 propsstate
- ReadableMap containing state defined in C++width
- width of the view (usually zero)widthMode
- widthMode used during calculation of layoutheight
- height of the view (usually zero)heightMode
- widthMode used during calculation of layoutattachmentsPositions
- array containing 2x times the amount of attachmentsof the view.
-
-
-
-