@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface ReactPropGroup
ViewManager
. It's a batched version of ReactProp
annotation (please see documentation of ReactProp
for more details about how this
annotation can be used).
This annotation is meant to be used for a group of similar properties. That's why it support only
a set of properties of the same type. A good example is supporting "border", where we have 7
variations of that property ("borderLeft", "borderHorizontal", etc.) and very similar code for
handling each of those.
Each annotated method should return void
and take exactly three arguments: first being
a view instance to be updated, second should be of type int and will represent index in the
group of the property being updated. Last, third argument represent the value that should be set.
Currently only int
, float
, double
and String
value types are
supported.
In case when property has been removed from the corresponding react component annotated setter
will be called and default value will be provided as a value parameter. Default value can be
customize using defaultInt()
or defaultFloat()
in the case when property is of
one of primitive types. In case when String
is the property type null
value will
be provided as a default.Modifier and Type | Required Element and Description |
---|---|
java.lang.String[] |
names
Array of names of properties exposed to JS that will be updated using setter method annotated
with the given instance of
ReactPropGroup annotation |
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
customType
Type of property that will be send to JS.
|
double |
defaultDouble
Default value for property of type
double . |
float |
defaultFloat
Default value for property of type
float . |
int |
defaultInt
Default value for property of type
int . |
public abstract java.lang.String[] names
ReactPropGroup
annotation@Nullable public abstract java.lang.String customType
customType
should not be
set in which case default type will be send to JS based on the type of value argument from the
setter method (e.g. for int
, float
default is "number"). Custom type may be
used when additional processing of the value needs to be done in JS before sending it over the
bridge. A good example of that would be backgroundColor property, which is expressed as a
String
in JS, but we use processColor
JS module to convert it to int
before sending over the bridge.public abstract float defaultFloat
float
. This value will be provided to property
setter method annotated with ReactPropGroup
if property with a given name gets removed
from the component description in JSpublic abstract double defaultDouble
double
. This value will be provided to property
setter method annotated with ReactPropGroup
if property with a given name gets removed
from the component description in JSpublic abstract int defaultInt
int
. This value will be provided to property
setter method annotated with ReactPropGroup
if property with a given name gets removed
from the component description in JS