Browse Source

fixed LightBox example

Artal Druk 8 years ago
parent
commit
bea823267e
2 changed files with 35 additions and 11 deletions
  1. 4
    1
      example/src/screens/FirstTabScreen.js
  2. 31
    10
      example/src/screens/LightBoxScreen.js

+ 4
- 1
example/src/screens/FirstTabScreen.js View File

120
       screen: "example.LightBoxScreen",
120
       screen: "example.LightBoxScreen",
121
       style: {
121
       style: {
122
         backgroundBlur: "dark"
122
         backgroundBlur: "dark"
123
-      }
123
+      },
124
+      passProps: {
125
+        greeting: 'hey there'
126
+      },
124
     });
127
     });
125
   }
128
   }
126
 
129
 

+ 31
- 10
example/src/screens/LightBoxScreen.js View File

1
 import React, {Component} from 'react';
1
 import React, {Component} from 'react';
2
 import {
2
 import {
3
+  StyleSheet,
3
   Text,
4
   Text,
4
   View,
5
   View,
5
-  ScrollView,
6
   TouchableOpacity,
6
   TouchableOpacity,
7
-  StyleSheet
7
+  Dimensions
8
 } from 'react-native';
8
 } from 'react-native';
9
 
9
 
10
 export default class LightBoxScreen extends Component {
10
 export default class LightBoxScreen extends Component {
13
   }
13
   }
14
   render() {
14
   render() {
15
     return (
15
     return (
16
-      <View style={{width: 300, height: 200, padding: 20}}>
17
-
18
-        <Text>
19
-          This is a LightBox
16
+      <View style={styles.container}>
17
+        <Text style={styles.welcome}>
18
+          This is a LightBox!
20
         </Text>
19
         </Text>
21
-
22
-        <TouchableOpacity onPress={ this.onDismissPress.bind(this) }>
20
+        {
21
+          this.props.greeting &&
22
+            <Text style={[styles.welcome, {fontSize: 16, marginTop: 20}]}>
23
+              {this.props.greeting}
24
+            </Text>
25
+        }
26
+        <TouchableOpacity onPress={() => this.onDismissPress()}>
23
           <Text style={styles.button}>Dismiss</Text>
27
           <Text style={styles.button}>Dismiss</Text>
24
         </TouchableOpacity>
28
         </TouchableOpacity>
25
-
26
       </View>
29
       </View>
27
     );
30
     );
28
   }
31
   }
31
   }
34
   }
32
 }
35
 }
33
 
36
 
34
-const styles = StyleSheet.create({
37
+var styles = StyleSheet.create({
38
+  container: {
39
+    flex: 1,
40
+    width: Dimensions.get('window').width * 0.8,
41
+    justifyContent: 'center',
42
+    alignItems: 'center',
43
+    backgroundColor: 'white',
44
+    borderRadius: 10
45
+  },
46
+  welcome: {
47
+    fontSize: 20,
48
+    textAlign: 'center',
49
+    margin: 10,
50
+  },
51
+  instructions: {
52
+    textAlign: 'center',
53
+    color: '#333333',
54
+    marginBottom: 5,
55
+  },
35
   button: {
56
   button: {
36
     textAlign: 'center',
57
     textAlign: 'center',
37
     fontSize: 18,
58
     fontSize: 18,