No Description

MoreViewController.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * Created by zack on 2018/4/30.
  3. */
  4. import {
  5. View,
  6. Text,
  7. StyleSheet,
  8. FlatList
  9. } from 'react-native'
  10. import React, {Component} from 'react'
  11. import {NavigationBarHeight, TabBarHeight, ScreenDimensions} from '../../../utils/DimensionsTools'
  12. import FindSearchResultItem from './View/FindSearchResultItem'
  13. import BaseNavigationBarStyle from '../../base/BaseNavigationBarStyle'
  14. import MoreSpecialQuestionTitleItem from './View/MoreSpecialQuestionTitleItem'
  15. import MoreSpecialQuestionItem from './View/MoreSpecialQuestionItem'
  16. export default class MoreViewController extends Component {
  17. constructor(props) {
  18. super(props)
  19. this.state = {
  20. }
  21. //根据init props来发送通知类型
  22. this.props.navigator.setStyle({
  23. navBarCustomView: 'FindSearchTitleView',
  24. })
  25. }
  26. renderItem(item) {
  27. if (item.index === 0) {
  28. return(
  29. <MoreSpecialQuestionTitleItem/>
  30. )
  31. }else {
  32. return(
  33. <MoreSpecialQuestionItem
  34. didSelectedItem = {() => {
  35. this.props.navigator.push({
  36. screen: 'AnswerDetailViewController',
  37. title: '问答',
  38. backButtonTitle: '',
  39. passProps: {
  40. },
  41. navigatorStyle: BaseNavigationBarStyle
  42. })
  43. }}
  44. />
  45. )
  46. }
  47. }
  48. render() {
  49. return(
  50. <View style={styles.View}>
  51. <View style={styles.ListView}>
  52. <FlatList
  53. data = {[{index: 0}, {index: 1}, {index: 2}, {index: 3}, {index: 4}, {index: 5}, {index: 6}, {index: 1}, {index: 2}]}
  54. renderItem={({item}) => this.renderItem(item)}
  55. keyExtractor = {(item,index) =>{
  56. return 'key' + item.key + index
  57. }}
  58. ListFooterComponent = {() => {
  59. return(
  60. <View style={{width: ScreenDimensions.width, height: 44, backgroundColor: 'white'}} />
  61. )
  62. }}
  63. />
  64. </View>
  65. </View>
  66. )
  67. }
  68. }
  69. const styles = StyleSheet.create({
  70. View: {
  71. width: ScreenDimensions.width,
  72. height: ScreenDimensions.height - NavigationBarHeight.height,
  73. backgroundColor: 'white'
  74. },
  75. ListView: {
  76. marginTop: NavigationBarHeight.height,
  77. width: ScreenDimensions.width,
  78. height: ScreenDimensions.height - NavigationBarHeight.height,
  79. backgroundColor: 'white'
  80. }
  81. })