React Prop
Use this annotation to annotate properties of native views that should be exposed to JS. This annotation should only be used for setter methods of subclasses of .
Each annotated method should return void
and take exactly two arguments: first being a view instance to be updated and second a value that should be set.
Allowed types of values are:
- primitives (int, boolean, double, float)
- String
- Boolean
- com.facebook.react.bridge.ReadableArray
- com.facebook.react.bridge.ReadableMap
When property gets removed from the corresponding component in React, annotated setter will be called with null
in case of non-primitive value type or with a default value in case when the value type is a primitive (use appropriate default field of this annotation to customize default value that is going to be used: defaultBoolean, defaultDouble, etc.)
Since in case of property removal for non-primitive value type setter will be called with value set to null
it's required that value type is annotated with Nullable.
Note: Since boolean property type can be represented both as primitive and wrapped default value set through defaultBoolean is only respected for primitive type and for the wrapped type null
will be used as a default.
Functions
boolean
.double
.float
.int
.long
.