searchResult.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * 搜索结果页面
  3. */
  4. import React, { Component } from "react";
  5. import {
  6. Platform,
  7. StyleSheet,
  8. Text,
  9. View,
  10. Image,
  11. TouchableOpacity,
  12. ImageBackground,
  13. Button,
  14. StatusBar,
  15. Modal,
  16. TouchableHighlight,
  17. DeviceEventEmitter,
  18. FlatList,
  19. TextInput
  20. } from "react-native";
  21. import BasePage from "./BasePage";
  22. import Dimensions from './utils/dimensions';
  23. import ShopBox from "./components/ShopBox";
  24. import TopicTitle from './components/TopicTitle';
  25. import ScrollRow from './components/ScrollRow';
  26. import CourseTitle from './components/CourseTitle';
  27. export default class SearchResult extends BasePage {
  28. componentDidMount() {
  29. const { searchText } = this.props.navigation.state.params;
  30. console.log('searchText',searchText)
  31. this.setState({
  32. text: searchText
  33. })
  34. // courseDetails.getCourseDetails(courseId).then(res => {
  35. // console.log('列表',res.data)
  36. // const courseList = res.data.course;
  37. // const wareList = res.data.wareList;
  38. // this.setState({
  39. // courseList,
  40. // wareList,
  41. // uri: wareList[0].playUrl
  42. // })
  43. // }).catch(err => {
  44. // console.log(err)
  45. // });
  46. }
  47. state = {
  48. text: ''
  49. };
  50. searchBox = () => {
  51. return (
  52. <View style={styles.searchBox}>
  53. <TextInput
  54. style={styles.searchInput}
  55. onChangeText={(text) => this.setState({ text })}
  56. value={this.state.text}
  57. renderItem={item => this.renderItem(item)}
  58. />
  59. </View>
  60. )
  61. }
  62. renderItem = (item) =>{
  63. return (
  64. <View>
  65. </View>
  66. )
  67. }
  68. render() {
  69. return (
  70. <View>
  71. <CourseTitle
  72. width={Dimensions.width}
  73. title="搜索"
  74. lefttype={1}
  75. textcolor={'#231F20'}
  76. backPress={() => this.goBack()}
  77. // backPress={() => alert("左侧按钮")}
  78. />
  79. {/* <FlatList
  80. ListHeaderComponent={() => this.searchBox()}
  81. /> */}
  82. </View>
  83. )
  84. }
  85. }
  86. const styles = StyleSheet.create({
  87. searchBox: {
  88. width: Dimensions.width,
  89. height: 60,
  90. alignItems: 'center',
  91. justifyContent: 'center',
  92. backgroundColor: '#f6f7f8'
  93. },
  94. searchInput: {
  95. width: '88.5%',
  96. height: 40,
  97. borderRadius: 20,
  98. backgroundColor: '#fff',
  99. paddingLeft: 15
  100. }
  101. })