Welcome.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React, {Component} from 'react'
  2. import {StyleSheet, View, Text, Image} from 'react-native'
  3. import {connect} from 'react-redux'
  4. import {NavigationActions, StackActions, ScreenUtil} from '../utils'
  5. import {ComponentsStyles} from '../components'
  6. @connect(auth => ({...auth}))
  7. class Welcome extends Component {
  8. constructor(props) {
  9. super(props);
  10. }
  11. componentDidMount() {
  12. const {navigation} = this.props;
  13. // const resetAction = NavigationActions.navigate({
  14. // routeName: "DesktopHome",
  15. // actions: [NavigationActions.navigate({routeName: 'DesktopHome'})],
  16. // })
  17. this.timer = setTimeout(
  18. () => {
  19. // navigation.dispatch(resetAction);
  20. navigation.navigate('DesktopHome');
  21. },
  22. 1000
  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}>©2023 郑州市凯贝特互感器有限公司 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