mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-09 17:13:46 +08:00
Use requireNativeComponent in website landing page example.
This commit is contained in:
18
website/src/react-native/index.js
vendored
18
website/src/react-native/index.js
vendored
@@ -226,10 +226,20 @@ RCT_EXPORT_VIEW_PROPERTY(myCustomProperty);
|
||||
<Prism>
|
||||
{`// JavaScript
|
||||
|
||||
module.exports = createReactIOSNativeComponentClass({
|
||||
validAttributes: { myCustomProperty: true },
|
||||
uiViewClassName: 'MyCustomView',
|
||||
});`}
|
||||
var React = require('react-native');
|
||||
var { requireNativeComponent } = React;
|
||||
|
||||
class MyCustomView extends React.Component {
|
||||
render() {
|
||||
return <NativeMyCustomView {...this.props} />;
|
||||
}
|
||||
}
|
||||
MyCustomView.propTypes = {
|
||||
myCustomProperty: React.PropTypes.oneOf(['a', 'b']),
|
||||
};
|
||||
|
||||
var NativeMyCustomView = requireNativeComponent('MyCustomView', MyCustomView);
|
||||
module.exports = MyCustomView;`}
|
||||
</Prism>
|
||||
</div>
|
||||
<section className="home-bottom-section">
|
||||
|
||||
Reference in New Issue
Block a user