Authored by 王海元
Committed by 王海元

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

... ... @@ -175,17 +175,32 @@ export default class Product extends Component {
if (productList.size == 0) {
return null;
}
return (<TabHeader
currentTab={currentTab}
onPressTab={(tab)=>{
if (tab == currentTab) {
return;
}
this.state.currentlyOpenSwipeable && this.state.currentlyOpenSwipeable.recenter();
this.setState({currentlyOpenSwipeable: null});
this.props.onPressTab && this.props.onPressTab(tab);
}}
/>)
let {selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
let isShow = currentTab === 'common' && selectedProductList.size > 0;
return (
<View>
<TabHeader
currentTab={currentTab}
onPressTab={(tab)=>{
if (tab == currentTab) {
return;
}
this.state.currentlyOpenSwipeable && this.state.currentlyOpenSwipeable.recenter();
this.setState({currentlyOpenSwipeable: null});
this.props.onPressTab && this.props.onPressTab(tab);
}}
/>
{isShow ? <CategorySelector
data={categoryList}
selectedCategoryIndex={selectedCategoryIndex}
onPressCategory={(rowData, rowID) => {
this.listView && this.listView.scrollTo({x: 0, y: 0, animated: false});
this.props.onPressCategory && this.props.onPressCategory(rowData, rowID);
}}
/> : null}
</View>
)
}
renderSectionHeader(sectionData, sectionID) {
... ... @@ -255,7 +270,7 @@ export default class Product extends Component {
dataSource={this.dataSource.cloneWithRows(dataArray)}
renderRow={this.renderRow}
renderHeader={this.renderHeader}
renderSectionHeader={this.renderSectionHeader}
// renderSectionHeader={this.renderSectionHeader}
onScroll={this.handleScroll}
renderFooter={this.renderFooter}
bounces={dataArray.length > 0}
... ...