Authored by 李犇

Merge remote-tracking branch 'origin/5.4.1' into 5.4.1

... ... @@ -14,6 +14,7 @@ import ReactNative, {
Platform,
RefreshControl,
} from 'react-native';
import TimerMixin from 'react-timer-mixin';
import Immutable, {Map} from 'immutable';
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
import YH_SortView from '../../../common/components/YH_SortView';
... ... @@ -84,6 +85,11 @@ export default class Home extends Component {
}
}
componentWillUnmount() {
this.requestAnimationFrame && TimerMixin.cancelAnimationFrame(this.requestAnimationFrame);
}
trigggePullToRefresh(changeChannel=false) {
let data = this._currentChannelData();
if (changeChannel) {
... ... @@ -150,8 +156,8 @@ export default class Home extends Component {
<DivideImage/>
<SingleImage
data={rowData}
onPressSlideItem={this.props.onPressSlideItem}
onPressTitleMore={this.props.onPressTitleMore}
onPressSlideItem={this.props.onPressChangeChannel}
onPressTitleMore={this.props.onPressChangeChannel}
/>
</View>
);
... ... @@ -444,15 +450,22 @@ export default class Home extends Component {
_onScroll(event) {
if (event.nativeEvent.contentOffset.y < height) {
if (this.state.showBackTop) {
this.setState({showBackTop: false, currentY: event.nativeEvent.contentOffset.y});
}
}else {
if (!this.state.showBackTop) {
this.setState({showBackTop: true, currentY: event.nativeEvent.contentOffset.y});
}
}
}
_backTop() {
this.setState({showBackTop: false});
// this.setState({showBackTop: false});
console.log(this.state.showBackTop);
InteractionManager.runAfterInteractions(() =>{
this.listView && this.listView.scrollTo({x: 0, y: 0, animated: true});
});
}
_renderFooter() {
... ...
... ... @@ -76,6 +76,7 @@ class HomeContainer extends Component {
this.onPressProductListProduct = this.onPressProductListProduct.bind(this);
this.onPressToProductDetail = this.onPressToProductDetail.bind(this);
this.onPressReloadData = this.onPressReloadData.bind(this);
this.onPressChangeChannel = this.onPressChangeChannel.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'ChannelDidChangeEvent',
... ... @@ -280,6 +281,17 @@ class HomeContainer extends Component {
this.props.actions.fetchFloor();
}
onPressChangeChannel() {
let {app} = this.props;
if (app.channel == 1) {
console.log(1111111);
ReactNative.NativeModules.YH_CommonHelper.switchChannelByTheme(0);
}else if (app.channel == 2) {
console.log(2222222);
ReactNative.NativeModules.YH_CommonHelper.switchChannelByTheme(1);
}
}
render() {
let {app, home} = this.props;
return (
... ... @@ -318,6 +330,7 @@ class HomeContainer extends Component {
onClickRecommendProduct={this.onClickRecommendProduct}
onPressToProductDetail={this.onPressToProductDetail}
onPressReloadData={this.onPressReloadData}
onPressChangeChannel={this.onPressChangeChannel}
/>
</View>
);
... ...