-
- All Implemented Interfaces:
-
com.facebook.react.bridge.NativeModule,com.facebook.react.uimanager.BaseViewManagerInterface,com.facebook.react.viewmanagers.AndroidSwitchManagerInterface
public class ReactSwitchManager extends SimpleViewManager<ReactSwitch> implements AndroidSwitchManagerInterface<ReactSwitch>
View manager for ReactSwitch components.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringREACT_CLASS
-
Constructor Summary
Constructors Constructor Description ReactSwitchManager()
-
Method Summary
Modifier and Type Method Description StringgetName()LayoutShadowNodecreateShadowNodeInstance()This method should return a subclass of ReactShadowNode which will be then used formeasuring position and size of the view. ClassgetShadowNodeClass()This method should return Class instance that represent type of shadow node that thismanager will return from createShadowNodeInstance. voidsetDisabled(ReactSwitch view, boolean disabled)voidsetEnabled(ReactSwitch view, boolean enabled)voidsetOn(ReactSwitch view, boolean on)voidsetValue(ReactSwitch view, boolean value)voidsetThumbTintColor(ReactSwitch view, @Nullable() Integer color)voidsetThumbColor(ReactSwitch view, @Nullable() Integer color)voidsetTrackColorForFalse(ReactSwitch view, @Nullable() Integer color)voidsetTrackColorForTrue(ReactSwitch view, @Nullable() Integer color)voidsetTrackTintColor(ReactSwitch view, @Nullable() Integer color)voidsetNativeValue(ReactSwitch view, boolean value)voidreceiveCommand(@NonNull() ReactSwitch view, String commandId, @Nullable() ReadableArray args)Subclasses may use this method to receive events/commands directly from JS through the . longmeasure(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.SimpleViewManager
getShadowNodeClass, updateExtraData -
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.AndroidSwitchManagerInterface
setDisabled, setEnabled, setNativeValue, setOn, setThumbColor, setThumbTintColor, setTrackColorForFalse, setTrackColorForTrue, setTrackTintColor, setValue -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
createShadowNodeInstance
LayoutShadowNode 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 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.
-
setDisabled
void setDisabled(ReactSwitch view, boolean disabled)
-
setEnabled
void setEnabled(ReactSwitch view, boolean enabled)
-
setOn
void setOn(ReactSwitch view, boolean on)
-
setValue
void setValue(ReactSwitch view, boolean value)
-
setThumbTintColor
void setThumbTintColor(ReactSwitch view, @Nullable() Integer color)
-
setThumbColor
void setThumbColor(ReactSwitch view, @Nullable() Integer color)
-
setTrackColorForFalse
void setTrackColorForFalse(ReactSwitch view, @Nullable() Integer color)
-
setTrackColorForTrue
void setTrackColorForTrue(ReactSwitch view, @Nullable() Integer color)
-
setTrackTintColor
void setTrackTintColor(ReactSwitch view, @Nullable() Integer color)
-
setNativeValue
void setNativeValue(ReactSwitch view, boolean value)
-
receiveCommand
void receiveCommand(@NonNull() ReactSwitch view, String commandId, @Nullable() ReadableArray args)
Subclasses may use this method to receive events/commands directly from JS through the . Good example of such a command would be
{@code scrollTo}request with coordinatesfor a ReactScrollView instance.- Parameters:
commandId- code of the commandargs- optional arguments for the command
-
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.
-
-
-
-