...
|
...
|
@@ -34,6 +34,8 @@ export default class Detail extends Component { |
|
|
super(props);
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this.renderHeader = this.renderHeader.bind(this);
|
|
|
this.scrollTo = this.scrollTo.bind(this);
|
|
|
this.listView = null;
|
|
|
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
...
|
...
|
@@ -50,6 +52,16 @@ export default class Detail extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
onLayout(rowID, e) {
|
|
|
let {y} = e.nativeEvent.layout;
|
|
|
this.props.onPressGoodY(y);
|
|
|
}
|
|
|
|
|
|
scrollTo(){
|
|
|
let {goods_group_y} = this.props.resource;
|
|
|
this.listView.scrollTo({x: 0, y: goods_group_y, animated: false});
|
|
|
}
|
|
|
|
|
|
renderHeader() {
|
|
|
let {resource} = this.props;
|
|
|
let {author,article} = resource;
|
...
|
...
|
@@ -81,8 +93,8 @@ export default class Detail extends Component { |
|
|
let list = data?data[goods_group_Filter]:null;
|
|
|
|
|
|
return (
|
|
|
<View style={styles.GoodsGroupHeader}>
|
|
|
<GoodsGroupHeader resource={{rowData,goods_group_Filter}} onPressFilter= {this.props.onPressFilter}/>
|
|
|
<View style={styles.GoodsGroupHeader} onLayout={this.onLayout.bind(this, rowID)}>
|
|
|
<GoodsGroupHeader resource={{rowData,goods_group_Filter}} onPressFilter= {this.props.onPressFilter} scrollTo={this.scrollTo}/>
|
|
|
<GoodsGroupList resource={list} onPressProduct={this.props.onPressProduct}/>
|
|
|
</View>
|
|
|
);
|
...
|
...
|
@@ -135,6 +147,7 @@ export default class Detail extends Component { |
|
|
|
|
|
return (
|
|
|
<ListView
|
|
|
ref={(ref)=>this.listView=ref}
|
|
|
contentContainerStyle={styles.contentContainer}
|
|
|
enableEmptySections={true}
|
|
|
showsVerticalScrollIndicator={false}
|
...
|
...
|
|