public class ReactSwitchManager extends SimpleViewManager<com.facebook.react.views.switchview.ReactSwitch> implements AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
ReactSwitch
components.NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REACT_CLASS |
sStateDescription
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
ReactSwitchManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEventEmitters(ThemedReactContext reactContext,
com.facebook.react.views.switchview.ReactSwitch view)
Subclasses can override this method to install custom event emitters on the given View.
|
LayoutShadowNode |
createShadowNodeInstance()
This method should return a subclass of
ReactShadowNode which will be then used for
measuring position and size of the view. |
protected com.facebook.react.views.switchview.ReactSwitch |
createViewInstance(ThemedReactContext context)
Subclasses should return a new View instance of the proper type.
|
protected ViewManagerDelegate<com.facebook.react.views.switchview.ReactSwitch> |
getDelegate()
Override this method and return an instance of
ViewManagerDelegate if the props of the
view managed by this view manager should be set via this delegate. |
java.lang.String |
getName() |
java.lang.Class |
getShadowNodeClass()
This method should return
Class instance that represent type of shadow node that this
manager will return from ViewManager.createShadowNodeInstance() . |
long |
measure(android.content.Context context,
ReadableMap localData,
ReadableMap props,
ReadableMap state,
float width,
YogaMeasureMode widthMode,
float height,
YogaMeasureMode heightMode,
int[] attachmentsPositions)
Subclasses can override this method to implement custom measure functions for the ViewManager
|
void |
receiveCommand(com.facebook.react.views.switchview.ReactSwitch view,
java.lang.String commandId,
ReadableArray args)
Subclasses may use this method to receive events/commands directly from JS through the
UIManager . |
void |
setDisabled(com.facebook.react.views.switchview.ReactSwitch view,
boolean disabled) |
void |
setEnabled(com.facebook.react.views.switchview.ReactSwitch view,
boolean enabled) |
void |
setNativeValue(com.facebook.react.views.switchview.ReactSwitch view,
boolean value) |
void |
setOn(com.facebook.react.views.switchview.ReactSwitch view,
boolean on) |
void |
setThumbColor(com.facebook.react.views.switchview.ReactSwitch view,
java.lang.Integer color) |
void |
setThumbTintColor(com.facebook.react.views.switchview.ReactSwitch view,
java.lang.Integer color) |
void |
setTrackColorForFalse(com.facebook.react.views.switchview.ReactSwitch view,
java.lang.Integer color) |
void |
setTrackColorForTrue(com.facebook.react.views.switchview.ReactSwitch view,
java.lang.Integer color) |
void |
setTrackTintColor(com.facebook.react.views.switchview.ReactSwitch view,
java.lang.Integer color) |
void |
setValue(com.facebook.react.views.switchview.ReactSwitch view,
boolean value) |
updateExtraData
getExportedCustomDirectEventTypeConstants, onAfterUpdateTransaction, setAccessibilityActions, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLiveRegion, setAccessibilityRole, setAccessibilityValue, setBackgroundColor, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderRadius, setBorderTopLeftRadius, setBorderTopRightRadius, setElevation, setImportantForAccessibility, setNativeId, setOpacity, setRenderToHardwareTexture, setRotation, setScaleX, setScaleY, setTestId, setTransform, setTranslateX, setTranslateY, setViewState, setZIndex
createShadowNodeInstance, createView, createViewInstance, getCommandsMap, getExportedCustomBubblingEventTypeConstants, getExportedViewConstants, getNativeProps, onDropViewInstance, receiveCommand, setPadding, updateLocalData, updateProperties, updateState
canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
public static final java.lang.String REACT_CLASS
public java.lang.String getName()
getName
in interface NativeModule
getName
in class ViewManager<com.facebook.react.views.switchview.ReactSwitch,LayoutShadowNode>
public LayoutShadowNode createShadowNodeInstance()
ViewManager
ReactShadowNode
which will be then used for
measuring position and size of the view. In most of the cases this should just return an
instance of ReactShadowNode
createShadowNodeInstance
in class SimpleViewManager<com.facebook.react.views.switchview.ReactSwitch>
public java.lang.Class getShadowNodeClass()
ViewManager
Class
instance that represent type of shadow node that this
manager will return from ViewManager.createShadowNodeInstance()
.
This method will be used in the bridge initialization phase to collect properties exposed
using ReactProp
(or ReactPropGroup
) annotation from the ReactShadowNode
subclass specific for native view this manager provides.
getShadowNodeClass
in class SimpleViewManager<com.facebook.react.views.switchview.ReactSwitch>
Class
object that represents type of shadow node used by this view manager.protected com.facebook.react.views.switchview.ReactSwitch createViewInstance(ThemedReactContext context)
ViewManager
createViewInstance
in class ViewManager<com.facebook.react.views.switchview.ReactSwitch,LayoutShadowNode>
public void setDisabled(com.facebook.react.views.switchview.ReactSwitch view, boolean disabled)
setDisabled
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setEnabled(com.facebook.react.views.switchview.ReactSwitch view, boolean enabled)
setEnabled
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setOn(com.facebook.react.views.switchview.ReactSwitch view, boolean on)
setOn
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setValue(com.facebook.react.views.switchview.ReactSwitch view, boolean value)
setValue
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setThumbTintColor(com.facebook.react.views.switchview.ReactSwitch view, java.lang.Integer color)
setThumbTintColor
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setThumbColor(com.facebook.react.views.switchview.ReactSwitch view, java.lang.Integer color)
setThumbColor
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setTrackColorForFalse(com.facebook.react.views.switchview.ReactSwitch view, java.lang.Integer color)
setTrackColorForFalse
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setTrackColorForTrue(com.facebook.react.views.switchview.ReactSwitch view, java.lang.Integer color)
setTrackColorForTrue
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setTrackTintColor(com.facebook.react.views.switchview.ReactSwitch view, java.lang.Integer color)
setTrackTintColor
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void setNativeValue(com.facebook.react.views.switchview.ReactSwitch view, boolean value)
setNativeValue
in interface AndroidSwitchManagerInterface<com.facebook.react.views.switchview.ReactSwitch>
public void receiveCommand(com.facebook.react.views.switchview.ReactSwitch view, java.lang.String commandId, ReadableArray args)
ViewManager
UIManager
. Good example of such a command would be scrollTo
request with coordinates
for a ReactScrollView
instance.receiveCommand
in class ViewManager<com.facebook.react.views.switchview.ReactSwitch,LayoutShadowNode>
view
- View instance that should receive the commandcommandId
- code of the commandargs
- optional arguments for the commandprotected void addEventEmitters(ThemedReactContext reactContext, com.facebook.react.views.switchview.ReactSwitch view)
ViewManager
addEventEmitters
in class ViewManager<com.facebook.react.views.switchview.ReactSwitch,LayoutShadowNode>
protected ViewManagerDelegate<com.facebook.react.views.switchview.ReactSwitch> getDelegate()
ViewManager
ViewManagerDelegate
if the props of the
view managed by this view manager should be set via this delegate. The provided instance will
then get calls to ViewManagerDelegate.setProperty(View, String, Object)
for every prop
that must be updated and it's the delegate's responsibility to apply these values to the view.
By default this method returns null
, which means that the view manager doesn't have
a delegate and the view props should be set internally by the view manager itself.
getDelegate
in class ViewManager<com.facebook.react.views.switchview.ReactSwitch,LayoutShadowNode>
ViewManagerDelegate
if the props of the view managed by this
view manager should be set via this delegatepublic long measure(android.content.Context context, ReadableMap localData, ReadableMap props, ReadableMap state, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode, int[] attachmentsPositions)
ViewManager
measure
in class ViewManager<com.facebook.react.views.switchview.ReactSwitch,LayoutShadowNode>
context
- 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
- int[]
array containing 2x times the amount of attachments
of the view. An attachment represents the position of an inline view that needs to be
rendered inside a component and it requires the content of the parent view in order to be
positioned. This array is meant to be used by the platform to RETURN the position of each
attachment, as a result of the calculation of layout. (e.g. this array is used to measure
inlineViews that are rendered inside Text components). On most of the components this array
will be contain a null value.
Even values will represent the TOP of each attachment, Odd values represent the LEFT of each attachment.