Skip to content

Commit 5c578ec

Browse files
committed
Basic example android index
Cleaned up android index, using new “local” bg image
1 parent fc3cec6 commit 5c578ec

File tree

2 files changed

+43
-41
lines changed

2 files changed

+43
-41
lines changed

examples/Basic/bgimage.jpeg

191 KB
Loading

examples/Basic/index.android.js

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,27 @@
11
/**
2-
* Sample React Native App
3-
* https://github.com/facebook/react-native
2+
* Basic [Android] Example for react-native-blur
3+
* https://github.com/react-native-community/react-native-blur
44
*/
55
'use strict';
6-
7-
var ReactNative = require('react-native');
8-
var React = require('react');
9-
var {
6+
import React, {Component} from 'react';
7+
import {
108
AppRegistry,
119
Image,
1210
findNodeHandle,
1311
StyleSheet,
1412
Text,
15-
View,
16-
} = ReactNative;
17-
18-
const styles = StyleSheet.create({
19-
container: {
20-
flex: 1,
21-
justifyContent: 'center',
22-
backgroundColor: 'transparent',
23-
},
24-
welcome: {
25-
fontSize: 20,
26-
textAlign: 'center',
27-
margin: 10,
28-
color: '#FFFFFF',
29-
},
30-
blurView: {
31-
position: "absolute",
32-
left: 0,
33-
top: 0,
34-
bottom: 0,
35-
right: 0
36-
},
37-
});
13+
View
14+
} from 'react-native';
3815

39-
var BlurView = require('react-native-blur').BlurView;
16+
import {BlurView} from 'react-native-blur';
4017

41-
var background = 'http://iphonewallpapers-hd.com/thumbs/firework_iphone_wallpaper_5-t2.jpg';
18+
class Basic extends Component {
4219

43-
class Basic extends React.Component {
44-
state = {
45-
viewRef: 0
20+
constructor() {
21+
super()
22+
this.state = {
23+
viewRef: 0,
24+
}
4625
}
4726

4827
imageLoaded() {
@@ -52,22 +31,45 @@ class Basic extends React.Component {
5231
render() {
5332
return (
5433
<Image
55-
source={{uri: background}}
34+
source={require('./bgimage.jpeg')}
5635
style={styles.container}
5736
ref={'backgroundImage'}
58-
onLoadEnd={this.imageLoaded.bind(this)}
59-
>
37+
onLoadEnd={this.imageLoaded.bind(this)}>
6038
<BlurView
6139
blurRadius={10}
6240
downsampleFactor={5}
63-
overlayColor={'rgba(255, 255, 255, 0.1)'}
41+
overlayColor={'rgba(255, 255, 255, .25)'}
6442
style={styles.blurView}
65-
viewRef={this.state.viewRef}
66-
/>
67-
<Text style={styles.welcome}>Blur component</Text>
43+
viewRef={this.state.viewRef}/>
44+
<Text style={styles.welcome}>{`Blur component`}</Text>
6845
</Image>
6946
);
7047
}
7148
}
7249

50+
const styles = StyleSheet.create({
51+
container: {
52+
flex: 1,
53+
justifyContent: 'center',
54+
backgroundColor: 'transparent',
55+
resizeMode: 'cover',
56+
width: null,
57+
height: null,
58+
},
59+
welcome: {
60+
fontSize: 22,
61+
fontWeight: 'bold',
62+
textAlign: 'center',
63+
margin: 10,
64+
color: '#FFFFFF',
65+
},
66+
blurView: {
67+
position: "absolute",
68+
left: 0,
69+
top: 0,
70+
bottom: 0,
71+
right: 0
72+
},
73+
});
74+
7375
AppRegistry.registerComponent('Basic', () => Basic);

0 commit comments

Comments
 (0)