Skip to content

Commit 07be457

Browse files
example: add button to show splash screen again
1 parent 601a293 commit 07be457

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

examples/App.js

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
Text,
1818
TouchableOpacity,
1919
Linking,
20+
Button,
2021
} from 'react-native'
2122
import SplashScreen from 'react-native-splash-screen'
2223

@@ -26,30 +27,37 @@ export default class example extends Component {
2627
SplashScreen.hide();
2728
}
2829

29-
3030
render() {
3131
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-
Email:crazycodeboy@gmail.com
50-
</Text>
32+
<View style={styles.container}>
33+
<TouchableOpacity
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+
Email:crazycodeboy@gmail.com
50+
</Text>
51+
</View>
52+
</TouchableOpacity>
53+
<View style={styles.showSplashButtonView}>
54+
<Button
55+
title={"Show splash screen again"}
56+
testID={"ShowSplashScreenButton"}
57+
onPress={()=> {SplashScreen.show(); setTimeout(()=> SplashScreen.hide(), 3000)}}
58+
/>
5159
</View>
52-
</TouchableOpacity>
60+
</View>
5361
)
5462
}
5563

@@ -59,7 +67,10 @@ const styles = StyleSheet.create({
5967
container: {
6068
flex: 1,
6169
backgroundColor: '#f3f2f2',
62-
marginTop: 30
70+
paddingTop: 30,
71+
paddingBottom: 30,
72+
paddingLeft: 30,
73+
paddingRight: 30,
6374
},
6475
item: {
6576
fontSize: 20,
@@ -69,4 +80,8 @@ const styles = StyleSheet.create({
6980
height: 0.3,
7081
backgroundColor: 'darkgray',
7182
},
83+
showSplashButtonView: {
84+
marginTop:30,
85+
alignSelf: 'baseline',
86+
}
7287
})

0 commit comments

Comments
 (0)