mirror of
https://github.com/status-im/react-native.git
synced 2025-02-05 06:04:15 +00:00
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
This commit is contained in:
parent
b5985cf690
commit
cdb2d2ee79
19
website/src/react-native/index.js
vendored
19
website/src/react-native/index.js
vendored
@ -328,15 +328,9 @@ var Message = React.createClass({
|
|||||||
{`// Java
|
{`// Java
|
||||||
|
|
||||||
public class MyCustomViewManager extends SimpleViewManager<MyCustomView> {
|
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
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return REACT_CLASS;
|
return "MyCustomView";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -344,13 +338,9 @@ public class MyCustomViewManager extends SimpleViewManager<MyCustomView> {
|
|||||||
return new MyCustomView(reactContext);
|
return new MyCustomView(reactContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@ReactProp(name = "myCustomProperty")
|
||||||
public void updateView(MyCustomView view, ReactStylesDiffMap props) {
|
public void setMyCustomProperty(MyCustomView view, String value) {
|
||||||
super.updateView(view, props);
|
view.setMyCustomProperty(value);
|
||||||
|
|
||||||
if (props.hasKey(PROP_MY_CUSTOM_PROPERTY)) {
|
|
||||||
view.setMyCustomProperty(props.getString(PROP_MY_CUSTOM_PROPERTY));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
@ -387,4 +377,3 @@ module.exports = MyCustomView;
|
|||||||
});
|
});
|
||||||
|
|
||||||
module.exports = index;
|
module.exports = index;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user