![]() ![]() In that case "default" value will be provided (for primitive types "default" value can be specified using defaultBoolean, defaultFloat, etc. In that case setter method will be called as well to notify view manager that property has changed. Note that one of the ways we can update component is by removing properties that have been set before. IMPORTANT! in ReactJS updating the property value will result in setter method call. Setter declaration requirements for methods annotated with are different than for please refer to the annotation class docs for more information about it. Note that "default" values are only provided for primitive types, in case when setter is of some complex type, null will be provided as a default value in case when corresponding property gets removed. Those arguments should be of the corresponding type (accordingly boolean, int, float in Java and Boolean, Int, Float in Kotlin) and the value provided will be passed to the setter method in case when the property that the setter is referencing has been removed from the component. Name assigned to the annotation linked to the setter method is used to reference the property on JS side.Įxcept from name, annotation may take following optional arguments: defaultBoolean, defaultInt, defaultFloat. The corresponding types in Kotlin are Boolean, Int, Float, Double, String, ReadableArray, ReadableMap.Īnnotation has one obligatory argument name of type String. The following type of values are currently supported (in Java): boolean, int, float, double, String, Boolean, Integer, ReadableArray, ReadableMap. Property type sent to JS is determined automatically based on the type of value argument of the setter. return type should be void in Java or Unit in Kotlin). Setter should be public and not return a value (i.e. Properties that are to be reflected in JavaScript needs to be exposed as setter method annotated with (or Setter method should take view to be updated (of the current view type) as a first argument and property value as a second argument. Expose view property setters using (or annotation Name returned by getName is used to reference the native view type from JavaScript.ģ. ReactImageView is the type of object managed by the manager, this will be the custom native view. In this example we create view manager class ReactImageManager that extends SimpleViewManager of type ReactImageView. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |