Launch.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. source={require('../images/tool-logo.png')}/>
  42. <Text style={styles.slogan}>Feel The Green Energy</Text>
  43. </View>
  44. </View>
  45. : <View style={styles.loaded}></View>
  46. );
  47. }
  48. }
  49. export default Launch
  50. const styles = StyleSheet.create({
  51. container: {
  52. alignItems: 'center',
  53. backgroundColor: colorPrimary,
  54. ...StyleSheet.absoluteFillObject
  55. },
  56. iosContent: {
  57. flex: 1,
  58. backgroundColor: colorPrimary
  59. },
  60. loaded: {
  61. flex: 1,
  62. backgroundColor: '#eee'
  63. },
  64. content: {
  65. alignItems: 'center',
  66. paddingTop: $vh(30)
  67. },
  68. logo: {
  69. width:165.09,
  70. height: 51.94,
  71. marginLeft: 10,
  72. //top: $vh(25),
  73. //bottom: $vh(25),
  74. //position: 'absolute'
  75. },
  76. slogan: {
  77. color: '#333',
  78. fontSize: 14,
  79. fontStyle: 'italic',
  80. fontWeight: 'bold'
  81. }
  82. });