From cdb2d2ee79c5aa06b7366b553d58844f542a2ebb Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Sat, 12 Mar 2016 16:46:54 -0800 Subject: [PATCH] Update outdated java custom view example on website Summary:The custom java view example on the website frontpage was pretty outdated :) **Test plan (required)** Tested by running the website locally. Closes https://github.com/facebook/react-native/pull/6435 Differential Revision: D3045976 fb-gh-sync-id: 7b9c48fe78988a7f2b329427a477a28abac99f11 shipit-source-id: 7b9c48fe78988a7f2b329427a477a28abac99f11 --- website/src/react-native/index.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/website/src/react-native/index.js b/website/src/react-native/index.js index a85130d54412b5..29796c45b67967 100644 --- a/website/src/react-native/index.js +++ b/website/src/react-native/index.js @@ -328,15 +328,9 @@ var Message = React.createClass({ {`// Java public class MyCustomViewManager extends SimpleViewManager { - - 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 @@ -344,13 +338,9 @@ public class MyCustomViewManager extends SimpleViewManager { 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); } } `} @@ -387,4 +377,3 @@ module.exports = MyCustomView; }); module.exports = index; -