Authored by 于良

消息中心主页面 review by days

@@ -32,20 +32,29 @@ export default class Message extends Component { @@ -32,20 +32,29 @@ export default class Message extends Component {
32 } 32 }
33 33
34 _renderRow(rowData: object, sectionID: number, rowID: number) { 34 _renderRow(rowData: object, sectionID: number, rowID: number) {
35 - return null; 35 +
  36 + return (
  37 + <TouchableOpacity
  38 + onPress={() => {
  39 + console.log(rowID)
  40 + }}
  41 + >
  42 + <View style={styles.rowContainer}>
  43 + <Text>{rowData.get('title')}</Text>
  44 + <Text>{rowData.get('detail')}</Text>
  45 + </View>
  46 + </TouchableOpacity>
  47 + );
36 } 48 }
37 49
38 50
39 render() { 51 render() {
40 52
41 - let dataSource = []; 53 + let dataSource = this.props.data.dataSource.toArray();
42 54
43 return ( 55 return (
44 <View style={styles.container}> 56 <View style={styles.container}>
45 <ListView 57 <ListView
46 - ref={(c) => {  
47 - this.listView = c;  
48 - }}  
49 contentContainerStyle={styles.contentContainer} 58 contentContainerStyle={styles.contentContainer}
50 dataSource={this.dataSource.cloneWithRows(dataSource)} 59 dataSource={this.dataSource.cloneWithRows(dataSource)}
51 renderRow={this._renderRow} 60 renderRow={this._renderRow}
@@ -66,4 +75,7 @@ let styles = StyleSheet.create({ @@ -66,4 +75,7 @@ let styles = StyleSheet.create({
66 contentContainer: { 75 contentContainer: {
67 76
68 }, 77 },
  78 + rowContainer: {
  79 +
  80 + },
69 }); 81 });
@@ -48,7 +48,6 @@ class MessageContainer extends Component { @@ -48,7 +48,6 @@ class MessageContainer extends Component {
48 super(props); 48 super(props);
49 49
50 this._onRefresh = this._onRefresh.bind(this); 50 this._onRefresh = this._onRefresh.bind(this);
51 - this._onEndReached = this._onEndReached.bind(this);  
52 51
53 52
54 } 53 }
@@ -65,10 +64,6 @@ class MessageContainer extends Component { @@ -65,10 +64,6 @@ class MessageContainer extends Component {
65 64
66 } 65 }
67 66
68 - _onEndReached() {  
69 -  
70 - }  
71 -  
72 render() { 67 render() {
73 let {message} = this.props; 68 let {message} = this.props;
74 return ( 69 return (
@@ -76,7 +71,6 @@ class MessageContainer extends Component { @@ -76,7 +71,6 @@ class MessageContainer extends Component {
76 <Message 71 <Message
77 data={message} 72 data={message}
78 onRefresh={this._onRefresh} 73 onRefresh={this._onRefresh}
79 - onEndReached={this._onEndReached}  
80 /> 74 />
81 </View> 75 </View>
82 ); 76 );
1 'use strict'; 1 'use strict';
2 2
3 -import {Record, List, Map} from 'immutable'; 3 +import Immutable, {Record, List, Map} from 'immutable';
4 4
5 -let InitialState = Record({ 5 +let dataSource = Immutable.fromJS([
  6 + {
  7 + id: 'member',
  8 + title: '会员信息',
  9 + detail: '会员等级变更提醒、会员生日福利',
  10 + },
  11 + {
  12 + id: 'asset',
  13 + title: '我的资产',
  14 + detail: '新注册用户提示新人专享优惠券信息',
  15 + },
  16 + {
  17 + id: 'customer',
  18 + title: '客户服务',
  19 + detail: '没有收到任何关于你的消息',
  20 + },
  21 + {
  22 + id: 'other',
  23 + title: '其他',
  24 + detail: '没有收到任何系统给消息',
  25 + },
  26 + ]);
6 27
  28 +let InitialState = Record({
  29 + dataSource,
  30 + newMessage: new (Record({
  31 + isFetching: false,
  32 + error: null,
  33 + data: List(),
  34 + })),
7 }); 35 });
8 36
9 export default InitialState; 37 export default InitialState;