Skip to content

Commit

Permalink
example: add button to show splash screen again
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo committed Jan 13, 2021
1 parent 601a293 commit 6045d0c
Showing 1 changed file with 43 additions and 23 deletions.
66 changes: 43 additions & 23 deletions examples/App.js
Expand Up @@ -17,6 +17,8 @@ import {
Text,
TouchableOpacity,
Linking,
Button,
Platform,
} from 'react-native'
import SplashScreen from 'react-native-splash-screen'

Expand All @@ -26,30 +28,41 @@ export default class example extends Component {
SplashScreen.hide();
}


render() {
return (
<TouchableOpacity
style={styles.container}
onPress={(e)=> {
Linking.openURL('https://coding.imooc.com/class/304.html');
}}
>
<View >
<Text style={styles.item}>
SplashScreen 启动屏
</Text>
<Text style={styles.item}>
@:http://www.devio.org/
</Text>
<Text style={styles.item}>
GitHub:https://github.com/crazycodeboy
</Text>
<Text style={styles.item}>
Email:crazycodeboy@gmail.com
</Text>
</View>
</TouchableOpacity>
<View style={styles.container}>
<TouchableOpacity
onPress={(e)=> {
Linking.openURL('https://coding.imooc.com/class/304.html');
}}
>
<View >
<Text style={styles.item}>
SplashScreen 启动屏
</Text>
<Text style={styles.item}>
@:http://www.devio.org/
</Text>
<Text style={styles.item}>
GitHub:https://github.com/crazycodeboy
</Text>
<Text style={styles.item}>
Email:crazycodeboy@gmail.com
</Text>
</View>
</TouchableOpacity>
{
// Show splash screen again on Windows and Android, for 3s.
(Platform.OS === 'windows' || Platform.OS === 'android') &&
<View style={styles.showSplashButtonView}>
<Button
title={"Show splash screen again"}
testID={"ShowSplashScreenButton"}
onPress={()=> {SplashScreen.show(); setTimeout(()=> SplashScreen.hide(), 3000)}}
/>
</View>
}
</View>
)
}

Expand All @@ -59,7 +72,10 @@ const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f3f2f2',
marginTop: 30
paddingTop: 30,
paddingBottom: 30,
paddingLeft: 30,
paddingRight: 30,
},
item: {
fontSize: 20,
Expand All @@ -69,4 +85,8 @@ const styles = StyleSheet.create({
height: 0.3,
backgroundColor: 'darkgray',
},
showSplashButtonView: {
marginTop:30,
alignSelf: 'baseline',
}
})

0 comments on commit 6045d0c

Please sign in to comment.