@@ -17,6 +17,8 @@ import {
17
17
Text ,
18
18
TouchableOpacity ,
19
19
Linking ,
20
+ Button ,
21
+ Platform ,
20
22
} from 'react-native'
21
23
import SplashScreen from 'react-native-splash-screen'
22
24
@@ -26,30 +28,41 @@ export default class example extends Component {
26
28
SplashScreen . hide ( ) ;
27
29
}
28
30
29
-
30
31
render ( ) {
31
32
return (
32
- < TouchableOpacity
33
- style = { styles . container }
34
- onPress = { ( e ) => {
35
- Linking . openURL ( 'https://coding.imooc.com/class/304.html' ) ;
36
- } }
37
- >
38
- < View >
39
- < Text style = { styles . item } >
40
- SplashScreen 启动屏
41
- </ Text >
42
- < Text style = { styles . item } >
43
- @:http://www.devio.org/
44
- </ Text >
45
- < Text style = { styles . item } >
46
- GitHub:https://github.com/crazycodeboy
47
- </ Text >
48
- < Text style = { styles . item } >
49
-
50
- </ Text >
51
- </ View >
52
- </ TouchableOpacity >
33
+ < View style = { styles . container } >
34
+ < TouchableOpacity
35
+ onPress = { ( e ) => {
36
+ Linking . openURL ( 'https://coding.imooc.com/class/304.html' ) ;
37
+ } }
38
+ >
39
+ < View >
40
+ < Text style = { styles . item } >
41
+ SplashScreen 启动屏
42
+ </ Text >
43
+ < Text style = { styles . item } >
44
+ @:http://www.devio.org/
45
+ </ Text >
46
+ < Text style = { styles . item } >
47
+ GitHub:https://github.com/crazycodeboy
48
+ </ Text >
49
+ < Text style = { styles . item } >
50
+
51
+ </ Text >
52
+ </ View >
53
+ </ TouchableOpacity >
54
+ {
55
+ // Show splash screen again on Windows and Android, for 3s.
56
+ ( Platform . OS === 'windows' || Platform . OS === 'android' ) &&
57
+ < View style = { styles . showSplashButtonView } >
58
+ < Button
59
+ title = { "Show splash screen again" }
60
+ testID = { "ShowSplashScreenButton" }
61
+ onPress = { ( ) => { SplashScreen . show ( ) ; setTimeout ( ( ) => SplashScreen . hide ( ) , 3000 ) } }
62
+ />
63
+ </ View >
64
+ }
65
+ </ View >
53
66
)
54
67
}
55
68
@@ -59,7 +72,10 @@ const styles = StyleSheet.create({
59
72
container : {
60
73
flex : 1 ,
61
74
backgroundColor : '#f3f2f2' ,
62
- marginTop : 30
75
+ paddingTop : 30 ,
76
+ paddingBottom : 30 ,
77
+ paddingLeft : 30 ,
78
+ paddingRight : 30 ,
63
79
} ,
64
80
item : {
65
81
fontSize : 20 ,
@@ -69,4 +85,8 @@ const styles = StyleSheet.create({
69
85
height : 0.3 ,
70
86
backgroundColor : 'darkgray' ,
71
87
} ,
88
+ showSplashButtonView : {
89
+ marginTop :30 ,
90
+ alignSelf : 'baseline' ,
91
+ }
72
92
} )
0 commit comments