@Documented
@Target(value=METHOD)
public @interface Prop
The method that is annotated with @Prop
must also comply with the following constraints:
ReactComponent
Modifier and Type | Optional Element and Description |
---|---|
Feature |
disposable
Return an enum indicating whether prop is disposable and should be checked before rendering component.
|
java.lang.String |
name
Return the name of the prop.
|
Feature |
require
Return enum indicating whether prop should be when component is constructed.
|
Feature |
shouldUpdateOnChange
Return an enum indicating whether prop should trigger a change if it updated.
|
@Nonnull public abstract java.lang.String name
public abstract Feature require
Feature.ENABLE
then the user MUST supply the prop and the builder will require the user
to specify the value. If set to Feature.DISABLE
then the user can optionally supply the prop.
If set to Feature.AUTODETECT
then the annotation processor will treat it as Feature.DISABLE
if there is a corresponding PropDefault
for the prop, otherwise it will be treated as
Feature.ENABLE
.public abstract Feature shouldUpdateOnChange
Component.shouldComponentUpdate(JsPropertyMap, JsPropertyMap)
lifecycle
method. If set to Feature.ENABLE
then the code will check the prop when implementing
shouldComponentUpdate
. If set to Feature.DISABLE
then the prop will be ignored
when implementing shouldComponentUpdate
. If set to Feature.AUTODETECT
then the
annotation processor will treat it as Feature.ENABLE
.public abstract Feature disposable
ReactArezComponent.anyPropsDisposed()
and check whether the prop is disposed prior to attempting to render the component. If any props
are disposed then rendering will be aborted and the render method will return null.
If set to Feature.ENABLE
then the code will add an isDisposed() check while if set to
Feature.DISABLE
no such check will be generated. If set to Feature.AUTODETECT
then the
annotation processor will inspect the type of the prop and treat it as Feature.ENABLE
if the
type is annotated with the arez.annotations.ArezComponent
annotation and the host component is
an Arez component. It is invalid to specify Feature.ENABLE
unless the host component is an Arez
component.