AllAnnounce.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import React, { Component } from 'react'
  2. import {
  3. StyleSheet,
  4. View,
  5. StatusBar,
  6. TouchableOpacity,
  7. Text,
  8. FlatList,
  9. ScrollView,
  10. } from 'react-native'
  11. import { connect } from 'react-redux'
  12. import { NavigationActions, createAction } from '../../../utils'
  13. import { ReturnDate } from '../../../utils/utils'
  14. @connect(({ theme, announce }) => ({ ...theme, ...announce }))
  15. class AllAnnounce extends Component {
  16. constructor() {
  17. super()
  18. }
  19. AnnounceRender(item) {
  20. const effectivedate = ReturnDate(item.item.effectivedate, true)
  21. const disabledate = ReturnDate(item.item.disabledate, true)
  22. return (
  23. <TouchableOpacity
  24. onPress={() => {
  25. this.props.dispatch(
  26. NavigationActions.navigate({
  27. routeName: 'AnnounceDetail',
  28. params: item,
  29. })
  30. )
  31. }}
  32. style={{ backgroundColor: '#FFF', padding: 10, marginTop: 10 }}
  33. >
  34. <Text numberOfLines={1} style={styles.headerText}>
  35. {item.item.title}
  36. </Text>
  37. {/* <View style={{ paddingRight: 15 }}>
  38. <Text numberOfLines={2} style={styles.contentText}>
  39. 2018年1月6日,第五届中国家居产业发展年会暨2017年度中国家居产业“大雁奖”颁奖盛
  40. </Text>
  41. </View> */}
  42. <View
  43. style={{
  44. flexDirection: 'row',
  45. justifyContent: 'space-between',
  46. marginTop: 11,
  47. }}
  48. >
  49. <Text style={styles.footerText}>生效日期:{effectivedate}</Text>
  50. <Text style={styles.footerText}>截止日期:{disabledate}</Text>
  51. </View>
  52. </TouchableOpacity>
  53. )
  54. }
  55. render() {
  56. const { appTheme, announceContent } = this.props
  57. return (
  58. <ScrollView
  59. tabLabel={this.props.tabLabel}
  60. style={styles.container}
  61. showsHorizontalScrollIndicator={false}
  62. >
  63. <FlatList
  64. data={announceContent.content}
  65. extraData={this.state}
  66. keyExtractor={(item, index) => index}
  67. renderItem={item => this.AnnounceRender(item)}
  68. />
  69. </ScrollView>
  70. )
  71. }
  72. }
  73. const styles = StyleSheet.create({
  74. container: {
  75. flex: 1,
  76. paddingHorizontal: 10,
  77. paddingBottom: 10,
  78. backgroundColor: '#f5f5f5',
  79. },
  80. headerText: {
  81. flex: 1,
  82. fontSize: 14,
  83. lineHeight: 20,
  84. letterSpacing: 0.17,
  85. color: '#333',
  86. },
  87. contentText: {
  88. flex: 1,
  89. marginTop: 4,
  90. fontSize: 12,
  91. lineHeight: 17,
  92. letterSpacing: 0.14,
  93. color: '#666',
  94. },
  95. footerText: {
  96. fontSize: 12,
  97. lineHeight: 17,
  98. letterSpacing: 0.14,
  99. color: '#999',
  100. },
  101. })
  102. export default AllAnnounce