Use requireNativeComponent in website landing page example.

This commit is contained in:
Spencer Ahrens 2015-04-22 14:44:37 -07:00
parent 8529b7bd6a
commit bd165e86e1
1 changed files with 14 additions and 4 deletions

View File

@ -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">