Use requireNativeComponent in website landing page example.
This commit is contained in:
parent
8529b7bd6a
commit
bd165e86e1
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue