ReactProp

annotation class ReactProp

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:

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.

Properties

Link copied to clipboard
val USE_DEFAULT_TYPE: String = "__default_type__"

Functions

Link copied to clipboard
abstract fun annotationType(): Class<out Annotation>
Link copied to clipboard
abstract fun customType(): String
Type of property that will be send to JS.
Link copied to clipboard
abstract fun defaultBoolean(): Boolean
Default value for property of type boolean.
Link copied to clipboard
abstract fun defaultDouble(): Double
Default value for property of type double.
Link copied to clipboard
abstract fun defaultFloat(): Float
Default value for property of type float.
Link copied to clipboard
abstract fun defaultInt(): Int
Default value for property of type int.
Link copied to clipboard
abstract fun defaultLong(): Long
Default value for property of type long.
Link copied to clipboard
abstract fun equals(p: Any): Boolean
Link copied to clipboard
abstract fun hashCode(): Int
Link copied to clipboard
abstract fun name(): String
Name of the property exposed to JS that will be updated using setter method annotated with the given instance of ReactProp annotation
Link copied to clipboard
abstract fun toString(): String