Authored by 王海元
Committed by 王海元

修改ListView混用renderSectionHeader的问题 —review by 孙凯

@@ -175,17 +175,32 @@ export default class Product extends Component { @@ -175,17 +175,32 @@ export default class Product extends Component {
175 if (productList.size == 0) { 175 if (productList.size == 0) {
176 return null; 176 return null;
177 } 177 }
178 - return (<TabHeader  
179 - currentTab={currentTab}  
180 - onPressTab={(tab)=>{  
181 - if (tab == currentTab) {  
182 - return;  
183 - }  
184 - this.state.currentlyOpenSwipeable && this.state.currentlyOpenSwipeable.recenter();  
185 - this.setState({currentlyOpenSwipeable: null});  
186 - this.props.onPressTab && this.props.onPressTab(tab);  
187 - }}  
188 - />) 178 + let {selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
  179 + let isShow = currentTab === 'common' && selectedProductList.size > 0;
  180 +
  181 + return (
  182 + <View>
  183 + <TabHeader
  184 + currentTab={currentTab}
  185 + onPressTab={(tab)=>{
  186 + if (tab == currentTab) {
  187 + return;
  188 + }
  189 + this.state.currentlyOpenSwipeable && this.state.currentlyOpenSwipeable.recenter();
  190 + this.setState({currentlyOpenSwipeable: null});
  191 + this.props.onPressTab && this.props.onPressTab(tab);
  192 + }}
  193 + />
  194 + {isShow ? <CategorySelector
  195 + data={categoryList}
  196 + selectedCategoryIndex={selectedCategoryIndex}
  197 + onPressCategory={(rowData, rowID) => {
  198 + this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
  199 + this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
  200 + }}
  201 + /> : null}
  202 + </View>
  203 + )
189 } 204 }
190 205
191 renderSectionHeader(sectionData, sectionID) { 206 renderSectionHeader(sectionData, sectionID) {
@@ -255,7 +270,7 @@ export default class Product extends Component { @@ -255,7 +270,7 @@ export default class Product extends Component {
255 dataSource={this.dataSource.cloneWithRows(dataArray)} 270 dataSource={this.dataSource.cloneWithRows(dataArray)}
256 renderRow={this.renderRow} 271 renderRow={this.renderRow}
257 renderHeader={this.renderHeader} 272 renderHeader={this.renderHeader}
258 - renderSectionHeader={this.renderSectionHeader} 273 + // renderSectionHeader={this.renderSectionHeader}
259 onScroll={this.handleScroll} 274 onScroll={this.handleScroll}
260 renderFooter={this.renderFooter} 275 renderFooter={this.renderFooter}
261 bounces={dataArray.length > 0} 276 bounces={dataArray.length > 0}