No Description

FindViewController.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * Created by zack on 2018/4/29.
  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. export default class FindViewController extends Component {
  15. constructor(props) {
  16. super(props)
  17. this.state = {
  18. }
  19. this.props.navigator.setStyle({
  20. navBarCustomView: 'FindSearchTitleView',
  21. })
  22. }
  23. renderItem() {
  24. return(
  25. <FindSearchResultItem
  26. didSelectedItem = {() => {
  27. this.props.navigator.push({
  28. screen: 'AnswerDetailViewController',
  29. title: '问答',
  30. backButtonTitle: '',
  31. passProps: {
  32. },
  33. navigatorStyle: BaseNavigationBarStyle
  34. })
  35. }}
  36. />
  37. )
  38. }
  39. render() {
  40. return(
  41. <View style={styles.View}>
  42. <View style={styles.ListView}>
  43. <FlatList
  44. data = {[{index: 0}, {index: 1}, {index: 2}, {index: 3}, {index: 4}, {index: 5}, {index: 6}, {index: 1}, {index: 2}]}
  45. renderItem={({item}) => this.renderItem(item)}
  46. keyExtractor = {(item,index) =>{
  47. return 'key' + item.key + index
  48. }}
  49. ListFooterComponent = {() => {
  50. return(
  51. <View style={{width: ScreenDimensions.width, height: 44, backgroundColor: 'white'}} />
  52. )
  53. }}
  54. />
  55. </View>
  56. </View>
  57. )
  58. }
  59. }
  60. const styles = StyleSheet.create({
  61. View: {
  62. width: ScreenDimensions.width,
  63. height: ScreenDimensions.height - NavigationBarHeight.height,
  64. backgroundColor: 'white'
  65. },
  66. ListView: {
  67. marginTop: NavigationBarHeight.height,
  68. width: ScreenDimensions.width,
  69. height: ScreenDimensions.height - NavigationBarHeight.height,
  70. backgroundColor: 'white'
  71. }
  72. })