Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update import statements based on React Native ^25.1 and convert Over… #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 51 additions & 54 deletions Overlay.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,66 @@

'use strict';

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

type Props = {
isVisible: boolean
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,
class Overlay extends Component {
constructor(props) {
super(props);
}

/**
* Determines the visibility of the Overlay. When it is not visible,
* an empty View is rendered.
*/
isVisible: React.PropTypes.bool,
},
render() {
var {
isVisible,
} = this.props;

getDefaultProps(): Props
{
return {
aboveStatusBar: false,
isVisible: false,
}
},
if (this.props.isVisible) {
return (
<RNOverlay isVisible={true} style={styles.container} pointerEvents="none" aboveStatusBar={this.props.aboveStatusBar}>
{React.Children.map(this.props.children, React.cloneElement)}
</RNOverlay>
);
} else {
return <View />;
}
}
}

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

render()
{
if (this.props.isVisible) {
return (
<RNOverlay
isVisible={true}
style={styles.container}
pointerEvents="none"
aboveStatusBar={this.props.aboveStatusBar}>
{
React.Children.map(this.props.children, React.cloneElement)
}
</RNOverlay>
)
;
} else {
return <View/>;
}
},
});
/**
* Determines the visibility of the Overlay. When it is not visible,
* an empty View is rendered.
*/
isVisible: PropTypes.bool,
};

Overlay.defaultProps = {
aboveStatusBar: false,
isVisible: false,
}

var RNOverlay = requireNativeComponent('RNOverlay', Overlay);

var styles = StyleSheet.create({
container: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
borderWidth: 0,
backgroundColor: 'transparent',
},
});
container: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
borderWidth: 0,
backgroundColor: 'transparent',
},
})

module.exports = Overlay;
module.exports = Overlay;