Last active
April 7, 2016 11:42
-
-
Save alfonsodev/3b9d42dd586408269b02b71d4c800040 to your computer and use it in GitHub Desktop.
blurOver.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Sample React Native App | |
| * https://github.com/facebook/react-native | |
| */ | |
| import React, { | |
| AppRegistry, | |
| Component, | |
| StyleSheet, | |
| Text, | |
| View, | |
| Image, | |
| TouchableOpacity, | |
| Alert, | |
| StatusBar, | |
| Animated, | |
| Easing | |
| } from 'react-native'; | |
| var {width,height} = require('Dimensions').get('window'); | |
| const { BlurView } = require('react-native-blur'); | |
| class Ghinwa extends Component { | |
| constructor(props) { | |
| super(props); | |
| StatusBar.setHidden(true); | |
| this.state = { | |
| top: new Animated.Value(height) | |
| } | |
| } | |
| _handlePress(msg) { | |
| Alert.alert('behind wins!') | |
| } | |
| _openOver() { | |
| Animated.timing(this.state.top, { toValue: 0 , duration: 400, easing: Easing.inOut(Easing.ease) }).start(); | |
| } | |
| _handlePressOver(msg) { | |
| Alert.alert('Over wins!') | |
| } | |
| render() { | |
| return ( | |
| <View style={styles.container}> | |
| <TouchableOpacity onPress={this._handlePress} style={styles.button} > | |
| <Text>Close pop over</Text> | |
| </TouchableOpacity> | |
| <TouchableOpacity onPress={this._openOver.bind(this)} style={styles.button} > | |
| <Text>Open pop over</Text> | |
| </TouchableOpacity> | |
| <TouchableOpacity onPress={this._handlePressOver} style={[styles.viewOver, {top:this.state.top}]}> | |
| <Image style={styles.imgBg} source={{ uri: 'http://localhost:3000/led.jpg'}} > | |
| <BlurView blurType="xlight" style={{flex:1, width: width }}> | |
| </BlurView> | |
| </Image> | |
| </TouchableOpacity> | |
| </View> | |
| ); | |
| } | |
| } | |
| const styles = StyleSheet.create({ | |
| container: { | |
| flex:1, | |
| flexDirection: 'column', | |
| backgroundColor: 'black' | |
| }, | |
| button: { | |
| backgroundColor: 'green', | |
| height:80 | |
| }, | |
| imgBg : { | |
| width: width, | |
| height: 80, | |
| }, | |
| viewOver:{ | |
| width: width, | |
| position:'absolute', | |
| top:0, | |
| height:80, | |
| backgroundColor:'red' | |
| } | |
| }); | |
| AppRegistry.registerComponent('Ghinwa', () => Ghinwa); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment