diff --git a/releases/next/index.html b/releases/next/index.html index 2589cf41582..4edba323c67 100644 --- a/releases/next/index.html +++ b/releases/next/index.html @@ -194,15 +194,9 @@ public class MyCustomModule extends

Creating Android views

Custom Android views can be exposed by extending SimpleViewManager, implementing a createViewInstance and getName methods, and exporting properties with the @UIProp annotation. Then a simple JavaScript file connects the dots.

// Java public class MyCustomViewManager extends SimpleViewManager<MyCustomView> { - - private static final String REACT_CLASS = "MyCustomView"; - - @UIProp(UIProp.Type.STRING) - public static final String PROP_MY_CUSTOM_PROPERTY = "myCustomProperty"; - @Override public String getName() { - return REACT_CLASS; + return "MyCustomView"; } @Override @@ -210,13 +204,9 @@ public class MyCustomViewManager extends < return new MyCustomView(reactContext); } - @Override - public void updateView(MyCustomView view, ReactStylesDiffMap props) { - super.updateView(view, props); - - if (props.hasKey(PROP_MY_CUSTOM_PROPERTY)) { - view.setMyCustomProperty(props.getString(PROP_MY_CUSTOM_PROPERTY)); - } + @ReactProp(name = "myCustomProperty") + public void setMyCustomProperty(MyCustomView view, String value) { + view.setMyCustomProperty(value); } }
// JavaScript