Skip to content

Commit

Permalink
Use requireNativeComponent in website landing page example.
Browse files Browse the repository at this point in the history
  • Loading branch information
sahrens committed Apr 22, 2015
1 parent 8529b7b commit bd165e8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions website/src/react-native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

1 comment on commit bd165e8

@brentvatne
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.