-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example: add button to show splash screen again
- Loading branch information
1 parent
601a293
commit 07be457
Showing
1 changed file
with
37 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { | |
Text, | ||
TouchableOpacity, | ||
Linking, | ||
Button, | ||
} from 'react-native' | ||
import SplashScreen from 'react-native-splash-screen' | ||
|
||
|
@@ -26,30 +27,37 @@ 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:[email protected] | ||
</Text> | ||
<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:[email protected] | ||
</Text> | ||
</View> | ||
</TouchableOpacity> | ||
<View style={styles.showSplashButtonView}> | ||
<Button | ||
title={"Show splash screen again"} | ||
testID={"ShowSplashScreenButton"} | ||
onPress={()=> {SplashScreen.show(); setTimeout(()=> SplashScreen.hide(), 3000)}} | ||
/> | ||
</View> | ||
</TouchableOpacity> | ||
</View> | ||
) | ||
} | ||
|
||
|
@@ -59,7 +67,10 @@ const styles = StyleSheet.create({ | |
container: { | ||
flex: 1, | ||
backgroundColor: '#f3f2f2', | ||
marginTop: 30 | ||
paddingTop: 30, | ||
paddingBottom: 30, | ||
paddingLeft: 30, | ||
paddingRight: 30, | ||
}, | ||
item: { | ||
fontSize: 20, | ||
|
@@ -69,4 +80,8 @@ const styles = StyleSheet.create({ | |
height: 0.3, | ||
backgroundColor: 'darkgray', | ||
}, | ||
showSplashButtonView: { | ||
marginTop:30, | ||
alignSelf: 'baseline', | ||
} | ||
}) |