react-native-overlay
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -11,4 +11,4 @@ { | ||
"react-native-blur": "^0.3.2", | ||
"react-native-overlay": "^0.1.1" | ||
"react-native-overlay": "^0.1.2" | ||
} | ||
} |
@@ -22,3 +22,10 @@ /** | ||
var ToastExampleApp = React.createClass({ | ||
render: function() { | ||
getInitialState(): any { | ||
return {isToastVisible: true}; | ||
}, | ||
hideToast() { | ||
this.setState({isToastVisible: false}); | ||
}, | ||
render() { | ||
return ( | ||
@@ -31,5 +38,5 @@ <View style={styles.container}> | ||
{ /* It doesn't matter where we put this component */ } | ||
<Toast isVisible={true}> | ||
<Toast isVisible={this.state.isToastVisible} onDismiss={this.hideToast}> | ||
<TouchableOpacity onPress={() => { AlertIOS.alert('Pressed on text!') }}> | ||
<Text style={styles.toastText}>Hello there!</Text> | ||
<Text style={styles.toastText}>This message is easy to display and dismiss! Write as much as you want to, also! It will just flow down.</Text> | ||
</TouchableOpacity> | ||
@@ -48,3 +55,5 @@ </Toast> | ||
color: '#ffffff', | ||
padding: 10, | ||
padding: 15, | ||
backgroundColor: 'transparent', | ||
fontSize: 14, | ||
}, | ||
@@ -51,0 +60,0 @@ image: { |
@@ -11,4 +11,4 @@ { | ||
"react-native-blur": "^0.3.2", | ||
"react-native-overlay": "^0.1.1" | ||
"react-native-overlay": "^0.1.2" | ||
} | ||
} |
@@ -15,2 +15,3 @@ /** | ||
TouchableOpacity, | ||
Text, | ||
} = React; | ||
@@ -23,13 +24,15 @@ | ||
var Toast = React.createClass({ | ||
getDefaultProps(): Props { | ||
return { | ||
isVisible: false | ||
} | ||
}, | ||
render(): ReactElement { | ||
return ( | ||
<Overlay isVisible={this.props.isVisible}> | ||
<BlurView style={styles.background} blurType="dark"> | ||
{this.props.children} | ||
<BlurView style={styles.background} blurType="light"> | ||
<View style={styles.content}> | ||
{this.props.children} | ||
</View> | ||
<TouchableOpacity onPress={this.props.onDismiss}> | ||
<View style={styles.dismissButton}> | ||
<Text style={styles.dismissButtonText}>Okay</Text> | ||
</View> | ||
</TouchableOpacity> | ||
</BlurView> | ||
@@ -43,10 +46,24 @@ </Overlay> | ||
background: { | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
flexDirection: 'row', | ||
}, | ||
content: { | ||
flex: 9, | ||
}, | ||
dismissButton: { | ||
flex: 1, | ||
backgroundColor: '#eeeeee', | ||
paddingLeft: 10, | ||
paddingRight: 10, | ||
borderRadius: 5, | ||
marginTop: 15, | ||
justifyContent: 'center', | ||
height: 30, | ||
marginRight: 15, | ||
}, | ||
dismissButtonText: { | ||
color: '#888888', | ||
fontSize: 12, | ||
}, | ||
}) | ||
module.exports = Toast; |
@@ -37,3 +37,3 @@ /** | ||
return ( | ||
<RNOverlay visible={true}> | ||
<RNOverlay visible={true} style={styles.container} pointerEvents="none"> | ||
{React.Children.map(this.props.children, React.addons.cloneWithProps)} | ||
@@ -53,2 +53,12 @@ </RNOverlay> | ||
var styles = StyleSheet.create({ | ||
container: { | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
}, | ||
}) | ||
module.exports = Overlay; |
{ | ||
"name": "react-native-overlay", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "An <Overlay /> component that brings content inside to the front of the view regardless of its current position in the component tree.", | ||
@@ -5,0 +5,0 @@ "main": "Overlay.ios.js", |
2125802
318