Skip to content

Commit

Permalink
Switch over to requireNativeComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Vatne committed May 30, 2015
1 parent c4a08b6 commit 6d44dd7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
25 changes: 17 additions & 8 deletions Overlay.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,36 @@

'use strict';

var createReactNativeComponentClass = require('createReactNativeComponentClass');
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var merge = require('merge');

var React = require('react-native');
var {
View,
PropTypes,
StyleSheet,
requireNativeComponent,
} = React;

type Props = {
isVisible: boolean;
}

var Overlay = React.createClass({
propTypes: {
/**
* When this property is set to `true`, the Overlay will appear on
* `UIWindowLevelStatusBar`, otherwise it will appear below that.
*/
aboveStatusBar: React.PropTypes.bool,

/**
* Determines the visibility of the Overlay. When it is not visible,
* an empty View is rendered.
*/
isVisible: React.PropTypes.bool,
},

getDefaultProps(): Props {
return {
aboveStatusBar: false,
isVisible: false,
}
},
Expand All @@ -44,10 +56,7 @@ var Overlay = React.createClass({
},
});

var RNOverlay = createReactNativeComponentClass({
validAttributes: merge(ReactNativeViewAttributes.UIView, {visible: true, aboveStatusBar: true}),
uiViewClassName: 'RNOverlay',
});
var RNOverlay = requireNativeComponent('RNOverlay', Overlay);

var styles = StyleSheet.create({
container: {
Expand Down
2 changes: 1 addition & 1 deletion RNOverlay.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (void)setVisible:(BOOL)visible {
object:nil];
}

- (void) reactBridgeDidFinishTransaction {
- (void)reactBridgeDidFinishTransaction {
// forward the `reactBridgeDidFinishTransaction` message to all our subviews
// in case their native representations do some logic in their handler
RCTTraverseViewNodes(_overlayBaseView, ^(id<RCTViewNodeProtocol> view) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-overlay",
"version": "0.2.2",
"version": "0.2.3",
"description": "An <Overlay /> component that brings content inside to the front of the view regardless of its current position in the component tree.",
"main": "Overlay.ios.js",
"author": "Brent Vatne <[email protected]> (https://github.com/brentvatne)",
Expand Down

0 comments on commit 6d44dd7

Please sign in to comment.