2015-10-05 20:41:32 +00:00
|
|
|
/**
|
|
|
|
* Sample React Native App
|
|
|
|
* https://github.com/facebook/react-native
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2016-05-06 09:35:18 +00:00
|
|
|
var ReactNative = require('react-native');
|
|
|
|
var React = require('react');
|
2015-10-05 20:41:32 +00:00
|
|
|
var {
|
|
|
|
AppRegistry,
|
2016-04-11 04:13:01 +00:00
|
|
|
Image,
|
|
|
|
findNodeHandle,
|
2015-10-05 20:41:32 +00:00
|
|
|
StyleSheet,
|
|
|
|
Text,
|
|
|
|
View,
|
2016-05-06 09:35:18 +00:00
|
|
|
} = ReactNative;
|
2015-10-05 20:41:32 +00:00
|
|
|
|
2016-04-11 04:13:01 +00:00
|
|
|
const styles = StyleSheet.create({
|
2015-10-05 20:41:32 +00:00
|
|
|
container: {
|
|
|
|
flex: 1,
|
|
|
|
justifyContent: 'center',
|
2016-04-11 04:13:01 +00:00
|
|
|
backgroundColor: 'transparent',
|
2015-10-05 20:41:32 +00:00
|
|
|
},
|
|
|
|
welcome: {
|
|
|
|
fontSize: 20,
|
|
|
|
textAlign: 'center',
|
|
|
|
margin: 10,
|
2016-04-11 04:13:01 +00:00
|
|
|
color: '#FFFFFF',
|
2015-10-05 20:41:32 +00:00
|
|
|
},
|
2016-04-11 04:13:01 +00:00
|
|
|
blurView: {
|
|
|
|
position: "absolute",
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
bottom: 0,
|
|
|
|
right: 0
|
2015-10-05 20:41:32 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2016-04-11 04:13:01 +00:00
|
|
|
var BlurView = require('react-native-blur').BlurView;
|
|
|
|
|
|
|
|
var background = 'http://iphonewallpapers-hd.com/thumbs/firework_iphone_wallpaper_5-t2.jpg';
|
|
|
|
|
|
|
|
class Basic extends React.Component {
|
|
|
|
state = {
|
|
|
|
viewRef: 0
|
|
|
|
}
|
|
|
|
|
|
|
|
imageLoaded() {
|
|
|
|
this.setState({viewRef: findNodeHandle(this.refs.backgroundImage)})
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Image
|
2016-06-13 20:40:35 +00:00
|
|
|
source={{uri: background}}
|
2016-04-11 04:13:01 +00:00
|
|
|
style={styles.container}
|
|
|
|
ref={'backgroundImage'}
|
2016-06-13 20:40:35 +00:00
|
|
|
onLoadEnd={this.imageLoaded.bind(this)}
|
2016-04-11 04:13:01 +00:00
|
|
|
>
|
|
|
|
<BlurView
|
|
|
|
blurRadius={10}
|
|
|
|
downsampleFactor={5}
|
|
|
|
overlayColor={'rgba(255, 255, 255, 0.1)'}
|
|
|
|
style={styles.blurView}
|
|
|
|
viewRef={this.state.viewRef}
|
|
|
|
/>
|
|
|
|
<Text style={styles.welcome}>Blur component</Text>
|
|
|
|
</Image>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-05 20:41:32 +00:00
|
|
|
AppRegistry.registerComponent('Basic', () => Basic);
|