...
|
...
|
@@ -24,11 +24,11 @@ export default class Product extends Component { |
|
|
super(props);
|
|
|
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this.renderHeader = this.renderHeader.bind(this);
|
|
|
// this.renderHeader = this.renderHeader.bind(this);
|
|
|
this.handleScroll = this.handleScroll.bind(this);
|
|
|
this.onOpen = this.onOpen.bind(this);
|
|
|
this.onClose = this.onClose.bind(this);
|
|
|
this.renderSectionHeader = this.renderSectionHeader.bind(this);
|
|
|
// this.renderSectionHeader = this.renderSectionHeader.bind(this);
|
|
|
this.renderFooter = this.renderFooter.bind(this);
|
|
|
|
|
|
this.dataSource = new ListView.DataSource({
|
...
|
...
|
@@ -148,9 +148,11 @@ export default class Product extends Component { |
|
|
renderFooter() {
|
|
|
let {
|
|
|
commonProduct,
|
|
|
globalProduct,
|
|
|
currentTab,
|
|
|
} = this.props.data;
|
|
|
if (currentTab == 'common' && commonProduct.get('productList').size == 0) {
|
|
|
if ((currentTab == 'common' && commonProduct.get('productList').size == 0)
|
|
|
|| (currentTab == 'global' && globalProduct.get('productList').size == 0)) {
|
|
|
return (
|
|
|
<NoDataView type={'product'} onPressGuangGuang={this.props.onPressGuangGuang}/>
|
|
|
);
|
...
|
...
|
@@ -164,72 +166,61 @@ export default class Product extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
renderHeader() {
|
|
|
let {
|
|
|
commonProduct,
|
|
|
globalProduct,
|
|
|
editing,
|
|
|
currentTab,
|
|
|
} = this.props.data;
|
|
|
let {productList} = globalProduct;
|
|
|
let {selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
|
|
|
let isShow = currentTab === 'common' && selectedProductList.size > 0;
|
|
|
|
|
|
return (
|
|
|
<View>
|
|
|
{productList.size > 0 ? <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);
|
|
|
}}
|
|
|
/> : null}
|
|
|
{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) {
|
|
|
let {
|
|
|
commonProduct,
|
|
|
globalProduct,
|
|
|
editing,
|
|
|
currentTab,
|
|
|
} = this.props.data;
|
|
|
|
|
|
if (currentTab == 'global') {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
if (currentTab == 'common') {
|
|
|
let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
|
|
|
if (selectedProductList.size == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
return (
|
|
|
<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);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
// renderHeader() {
|
|
|
// let {
|
|
|
// commonProduct,
|
|
|
// globalProduct,
|
|
|
// editing,
|
|
|
// currentTab,
|
|
|
// } = this.props.data;
|
|
|
// let {productList} = globalProduct;
|
|
|
// let {selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
|
|
|
// let isShow = currentTab === 'common' && selectedProductList.size > 0;
|
|
|
|
|
|
// return (
|
|
|
// <View>
|
|
|
// {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) {
|
|
|
// let {
|
|
|
// commonProduct,
|
|
|
// globalProduct,
|
|
|
// editing,
|
|
|
// currentTab,
|
|
|
// } = this.props.data;
|
|
|
|
|
|
// if (currentTab == 'global') {
|
|
|
// return null;
|
|
|
// }
|
|
|
|
|
|
// if (currentTab == 'common') {
|
|
|
// let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = commonProduct;
|
|
|
// if (selectedProductList.size == 0) {
|
|
|
// return null;
|
|
|
// }
|
|
|
// return (
|
|
|
// <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);
|
|
|
// }}
|
|
|
// />
|
|
|
// );
|
|
|
// }
|
|
|
// return null;
|
|
|
// }
|
|
|
|
|
|
render() {
|
|
|
|
...
|
...
|
@@ -266,7 +257,7 @@ export default class Product extends Component { |
|
|
enableEmptySections={true}
|
|
|
dataSource={this.dataSource.cloneWithRows(dataArray)}
|
|
|
renderRow={this.renderRow}
|
|
|
renderHeader={this.renderHeader}
|
|
|
//renderHeader={this.renderHeader}
|
|
|
// renderSectionHeader={this.renderSectionHeader}
|
|
|
onScroll={this.handleScroll}
|
|
|
renderFooter={this.renderFooter}
|
...
|
...
|
|