Authored by yoho-js001

解决数据丢失的问题。

@@ -93,6 +93,9 @@ export default class Brand extends Component { @@ -93,6 +93,9 @@ export default class Brand extends Component {
93 let title = sectionID == '0-9' ? '0' : sectionID; 93 let title = sectionID == '0-9' ? '0' : sectionID;
94 // console.log(sectionID); 94 // console.log(sectionID);
95 // console.log(rowData); 95 // console.log(rowData);
  96 + // if (sectionID == '0-9') {
  97 + // console.log('should appears!!!!!!!!!!!!!!');
  98 + // }
96 return ( 99 return (
97 <View onLayout={this.onLayout.bind(this, sectionID)}> 100 <View onLayout={this.onLayout.bind(this, sectionID)}>
98 <BLKBrandCell title={title} rowData={rowData} onPressBrandItem={this.props.onPressBrandItem}/> 101 <BLKBrandCell title={title} rowData={rowData} onPressBrandItem={this.props.onPressBrandItem}/>
@@ -137,9 +140,16 @@ export default class Brand extends Component { @@ -137,9 +140,16 @@ export default class Brand extends Component {
137 140
138 list = data ? data.get('all_list') : null; 141 list = data ? data.get('all_list') : null;
139 let newList = {}; 142 let newList = {};
140 - list && list.map((value, key) => {  
141 - newList[key] = [value.toArray()];  
142 - }); 143 + let keyList = list? list.keySeq().toArray().sort():[];
  144 + for (var i = 0; i < keyList.length; i++) {
  145 + let key = keyList[i];
  146 + // console.log(list.get(key).toArray());
  147 + let item = list.get(key).toArray();
  148 + if (item.length) {
  149 + newList[key] = [list.get(key).toArray()];
  150 + }
  151 + }
  152 +
143 // console.log(newList); 153 // console.log(newList);
144 // console.log('aaaaa'); 154 // console.log('aaaaa');
145 // console.log(data?data.toJS():'null'); 155 // console.log(data?data.toJS():'null');
@@ -166,7 +176,7 @@ export default class Brand extends Component { @@ -166,7 +176,7 @@ export default class Brand extends Component {
166 showsVerticalScrollIndicator={showsVerticalScrollIndicator} 176 showsVerticalScrollIndicator={showsVerticalScrollIndicator}
167 renderHeader={this.renderHeader} 177 renderHeader={this.renderHeader}
168 /> 178 />
169 - <IndexListView dataSource={list.keySeq().toArray()} onLetterPress={this.scrollToSection}/> 179 + <IndexListView dataSource={list.keySeq().toArray().sort()} onLetterPress={this.scrollToSection}/>
170 <LoadingIndicator 180 <LoadingIndicator
171 isVisible={isFetching} 181 isVisible={isFetching}
172 /> 182 />