Launch.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * 开屏页面
  3. * @邠心vbe on 2021/03/22
  4. */
  5. import React from 'react'
  6. import { Image, StyleSheet, Text, View } from 'react-native'
  7. import {InitSomething} from '../components/Dialog';
  8. import { PageList } from './Router';
  9. class Launch extends React.Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. isShow: true
  14. };
  15. }
  16. componentDidMount() {
  17. InitSomething();
  18. if (isIOS) {
  19. this.goHome(100);
  20. } else {
  21. this.goHome(3000);
  22. }
  23. }
  24. goHome(time) {
  25. setTimeout(() => {
  26. this.setState({
  27. isShow: false
  28. });
  29. startPage(PageList.home);
  30. }, time);
  31. }
  32. render() {
  33. return (
  34. this.state.isShow
  35. ? isIOS
  36. ? <View style={styles.iosContent}></View>
  37. : <View style={styles.container}>
  38. <View style={styles.content}>
  39. <Image
  40. style={styles.logo}
  41. resizeMode='contain'
  42. source={require('../images/app-logo.png')}/>
  43. {/* <Text style={styles.slogan}>Feel The Green Energy</Text> */}
  44. </View>
  45. </View>
  46. : <View style={styles.loaded}></View>
  47. );
  48. }
  49. }
  50. export default Launch
  51. const styles = StyleSheet.create({
  52. container: {
  53. alignItems: 'center',
  54. backgroundColor: colorThemes,
  55. ...StyleSheet.absoluteFillObject
  56. },
  57. iosContent: {
  58. flex: 1,
  59. backgroundColor: colorThemes
  60. },
  61. loaded: {
  62. flex: 1,
  63. backgroundColor: '#eee'
  64. },
  65. content: {
  66. alignItems: 'center',
  67. paddingTop: $vh(30)
  68. },
  69. logo: {
  70. width: 190.67,
  71. height: 60,
  72. marginLeft: 0,
  73. //top: $vh(25),
  74. //bottom: $vh(25),
  75. //position: 'absolute'
  76. },
  77. slogan: {
  78. color: '#333',
  79. fontSize: 14,
  80. fontStyle: 'italic',
  81. fontWeight: 'bold'
  82. }
  83. });