Welcome.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import React, {Component} from 'react'
  2. import {StyleSheet, View, Text, Image} from 'react-native'
  3. import SyncStorage from 'sync-storage';
  4. import {connect} from 'react-redux'
  5. import {NavigationActions, StackActions, ScreenUtil} from '../utils'
  6. import {ComponentsStyles} from '../components'
  7. @connect(auth => ({...auth}))
  8. class Welcome extends Component {
  9. constructor(props) {
  10. super(props);
  11. }
  12. componentDidMount() {
  13. const {navigation} = this.props;
  14. const resetAction = NavigationActions.navigate({
  15. routeName: "DesktopHome",
  16. actions: [NavigationActions.navigate({routeName: 'DesktopHome'})],
  17. })
  18. this.timer = setTimeout(
  19. () => {
  20. navigation.dispatch(resetAction);
  21. },
  22. 2000
  23. );
  24. }
  25. componentWillUnmount() {
  26. this.timer && clearTimeout(this.timer);
  27. }
  28. render() {
  29. return (
  30. <View style={ComponentsStyles.container}>
  31. <View style={styles.up}>
  32. <Image source={require('../../assets/images/logo.png')} style={styles.logo}/>
  33. <Text style={styles.title}>电金睛</Text>
  34. </View>
  35. <View style={styles.down}>
  36. <Text style={styles.rights}>©2021 郑州市凯贝特互感器有限公司 All rights reserved.</Text>
  37. </View>
  38. </View>
  39. )
  40. }
  41. }
  42. const styles = StyleSheet.create({
  43. up: {
  44. flex: 4,
  45. paddingTop: ScreenUtil.scaleSize(80),
  46. textAlign: 'center',
  47. alignItems: 'center',
  48. },
  49. logo: {
  50. width: ScreenUtil.scaleSize(80),
  51. height: ScreenUtil.scaleSize(80),
  52. },
  53. title: {
  54. paddingTop: 20,
  55. fontSize: ScreenUtil.scaleSize(24),
  56. color: '#5394e4',
  57. textAlign: 'center',
  58. },
  59. down: {
  60. flex: 1,
  61. textAlign: 'center',
  62. justifyContent: 'flex-end'
  63. },
  64. rights: {
  65. height: 50,
  66. fontSize: ScreenUtil.scaleSize(12),
  67. color: '#aaaaaa',
  68. textAlign: 'center',
  69. }
  70. })
  71. export default Welcome