No Description

FollowPageView.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. * Created by zack on 2018/5/2.
  3. */
  4. import {
  5. View,
  6. Text,
  7. StyleSheet,
  8. Image,
  9. TouchableOpacity,
  10. FlatList
  11. } from 'react-native'
  12. import React, {Component} from 'react'
  13. import {NavigationBarHeight, TabBarHeight, ScreenDimensions} from '../../../utils/DimensionsTools'
  14. import FollowingItem from './View/FollowingItem'
  15. import HttpTools from '../../../network/HttpTools'
  16. import {auth, question, comment} from '../../../network/API'
  17. export default class FollowPageView extends Component {
  18. constructor(props) {
  19. super(props)
  20. this.state = {
  21. dataSources: ['a'],
  22. }
  23. }
  24. componentDidMount() {
  25. // const param = {
  26. // page: 1,
  27. // limit: 10,
  28. // }
  29. // HttpTools.get('my/focus', param, (response) => {
  30. // console.log(response)
  31. // }, (error) => {
  32. // console.log(error)
  33. // })
  34. }
  35. renderItem(item) {
  36. return(
  37. <FollowingItem />
  38. )
  39. }
  40. render() {
  41. if (this.state.dataSources.length) {
  42. return(
  43. <View style={styles.View}>
  44. <View style={styles.ListView}>
  45. <FlatList
  46. data = {['a', 'b', 'c']}
  47. renderItem={({item}) => this.renderItem(item)}
  48. keyExtractor = {(item,index) =>{
  49. return 'key' + item.key + index
  50. }}
  51. ListFooterComponent = {() => {
  52. return(
  53. <View style={{width: ScreenDimensions.width, height: 44, backgroundColor: 'white'}} />
  54. )
  55. }}
  56. />
  57. </View>
  58. </View>
  59. )
  60. }else {
  61. return(
  62. <View style={styles.View}>
  63. <Image source={require('../../../resources/images/TabBar/Community/Follow/img.png')} style={styles.BlankImageView}/>
  64. <Text style={styles.TitleText}>{'关注的人更新动态会出现在这里'}</Text>
  65. <TouchableOpacity onPress={() => {
  66. this.props.didClickFollowButton()
  67. }} style={styles.FollowButton}>
  68. <Text style={styles.FollowButtonText}>{"关注感兴趣的人"}</Text>
  69. </TouchableOpacity>
  70. </View>
  71. )
  72. }
  73. }
  74. }
  75. const styles = StyleSheet.create({
  76. View: {
  77. width: ScreenDimensions.width,
  78. height: ScreenDimensions.height,
  79. backgroundColor: '#ffffff',
  80. alignItems: 'center',
  81. },
  82. ListView: {
  83. width: ScreenDimensions.width,
  84. height: ScreenDimensions.height - NavigationBarHeight.height - TabBarHeight.height,
  85. },
  86. BlankImageView: {
  87. marginTop: NavigationBarHeight.height + 80,
  88. width: 175,
  89. height: 143,
  90. },
  91. TitleText: {
  92. fontSize: 17,
  93. color: '#05120b',
  94. marginTop: 45,
  95. },
  96. FollowButton: {
  97. marginTop: 25,
  98. width: 230,
  99. height: 46,
  100. backgroundColor: '#ffffff',
  101. borderWidth: 1.0,
  102. borderColor: '#fc4747',
  103. borderRadius: 23,
  104. justifyContent: 'center',
  105. alignItems: 'center'
  106. },
  107. FollowButtonText: {
  108. fontSize: 17,
  109. color: '#fc4747',
  110. }
  111. })