Authored by 于良

Merge branch '5.4.1' of http://git.yoho.cn/mobile/YH_RNComponent into 5.4.1

... ... @@ -40,12 +40,6 @@ export default class BLKChannelSelector extends React.Component {
id: 2,
isSelect: false,
},
{
name: 'LIFESTYLE生活',
value: 'lifestyle',
id: 4,
isSelect: false,
},
];
}
... ... @@ -134,7 +128,7 @@ let styles = StyleSheet.create({
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
width: Math.ceil(width / 3),
width: Math.ceil(width / 2),
height: viewHeight,
backgroundColor:'white',
},
... ...
... ... @@ -76,21 +76,6 @@ export default class Brand extends Component {
renderHeader() {
return (
<View style={styles.header}>
<TouchableOpacity
activeOpacity={1}
onPress={() => {
this.props.onPressSearch && this.props.onPressSearch();
}}
>
<YH_SearchBar
ref={(c) => {
this.searchBar = c;
}}
placeholder={"搜索品牌"}
editable={false}
/>
</TouchableOpacity>
<BrandHeader
selectedChannelId={this.props.selectedChannelId}
reourceForBoy={this.props.reourceForBoy}
... ...
... ... @@ -332,10 +332,10 @@ export function getBrandResource(channel) {
let content_code;
if (channel == 1) {
dispatch(getBrandResourceForBoyRequest());
content_code = 'ce6ac059493ec26241a8cbe0bfa1b17a';
content_code = '7317a4701a1d3ddc8d93a5df77a63b75';
}else if (channel == 2) {
dispatch(getBrandResourceForGirlRequest());
content_code = 'dac99cdedc1f948e84c145aca561f7d2';
content_code = '84313c4b293a1c0aea985aa16a42a6b5';
}else if (channel == 3) {
dispatch(getBrandResourceForKidRequest());
content_code = '713784f93f52bb1a7b93916b2bb15510';
... ...
... ... @@ -69,10 +69,11 @@ export default class ProductListCell extends Component {
return (
<View style={styles.imageContainer}>
<YH_Image style={styles.image} url={url}>
<YH_Image style={styles.image} url={url} isBackground={true}>
{rowID == similarIndex?
<SimilarProductAnim
onPressFindSimilar={this.props.onPressFindSimilar}
product={data}
onPressDislike={this.props.onPressDislike}
/>
:null}
... ...
... ... @@ -58,7 +58,7 @@ export default class SimilarProductAnim extends Component {
justifyContent: 'center',
alignItems: 'center',
}}
onPress={()=>{this.props.onPressFindSimilar&&this.props.onPressFindSimilar();}}
onPress={()=>{this.props.onPressFindSimilar&&this.props.onPressFindSimilar(this.props.product);}}
>
<Text style={{fontSize:14, color:'white'}}>找相似</Text>
</TouchableOpacity>
... ... @@ -72,7 +72,7 @@ export default class SimilarProductAnim extends Component {
alignItems: 'center',
marginTop: 15,
}}
onPress={()=>{this.props.onPressDislike&&this.props.onPressDislike();}}
onPress={()=>{this.props.onPressDislike&&this.props.onPressDislike(this.props.product);}}
>
<Text style={{fontSize:14, color:'white'}}>不喜欢</Text>
</TouchableOpacity>
... ...
... ... @@ -8,9 +8,12 @@ const {
const {
Image,
PixelRatio,
Platform,
} = ReactNative;
const YH_ImageView = ReactNative.requireNativeComponent('YH_ImageView', null);
const YH_BackgroundView = (Platform.OS === 'ios') ? null : ReactNative.requireNativeComponent('YH_BackgroundView', null);
/**
... ... @@ -49,10 +52,31 @@ export default class YH_Image extends Component {
}
render() {
return (
<YH_ImageView
{...this.props}
/>
);
if (Platform.OS === 'ios') {
return (
<YH_ImageView
{...this.props}
/>
);
}
else{
let {isBackground} = this.props;
if(isBackground && isBackground == true){
// return null;
return (
<YH_BackgroundView
{...this.props}
/>
);
}
else{
return (
<YH_ImageView
{...this.props}
/>
);
}
}
}
}
... ...
... ... @@ -71,7 +71,7 @@ export default class AppIconList extends React.Component {
listContainerStyle = styles.brandContainer4
}
return(
<YH_Image style={[styles.container, {height: containerHeight}]} url={this.props.backImage}>
<YH_Image style={[styles.container, {height: containerHeight}]} url={this.props.backImage} isBackground={true}>
<ListView
contentContainerStyle={listContainerStyle}
enableEmptySections={true}
... ...
... ... @@ -25,73 +25,70 @@ import YH_Image from '../../../common/components/YH_Image';
export default class HotCategoryIndividualization extends Component {
constructor(props) {
super(props);
this._renderRow = this._renderRow.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderRow(rowData, sectionID, rowID, highlightRow) {
let title = rowData.get('title');
let actionUrl = rowData.get('url');
let imgUrl = SlicedImage.getSlicedUrl(rowData.get('src'),imageWidth,imageHeight,2);
return (
<TouchableOpacity style={styles.cellContainer}
onPress={()=>this.props.onPressVipBannerItem&&this.props.onPressVipBannerItem(actionUrl,rowID)}>
<YH_Image style={styles.image}
url={imgUrl}/>
<Text style={styles.text}>{title}</Text>
</TouchableOpacity>
);
}
render() {
let data = this.props.data;
let title = data.get('title').get('title');
let categoryData = data.get('list');
let rowH = 40 + 2 + cellHeight * 3;
let title = this.props.data.get('title');
let data = this.props.data.get('list').toArray();
let lineNumber = parseInt((data.length + 3) / 4);
let listHeight = Math.floor(lineNumber * cellHeight);
let containerHeight = listHeight + 40;
return (
<View style={{width:width,height:rowH}}>
<HeadTitleCell title={title}/>
<View style={styles.line}/>
<ListView
contentContainerStyle={styles.listContent}
dataSource={this.dataSource.cloneWithRows(categoryData.toArray())}
renderRow={this._renderRow}
initialListSize={12}
showsHorizontalScrollIndicator={false}
/>
<View style={styles.line}/>
<View style={[styles.container, {height: containerHeight}]}>
<HeadTitleCell title={title.get('title')} moreUrl={title.get('more_url')} onPressTitleMore={this.props.onPressTitleMore}/>
<View style={[styles.list, {height: listHeight}]}>
{data.map((item, i) => {
let url = YH_Image.getSlicedUrl(item.get('src'), imageWidth, imageHeight, 2);
return (
<TouchableOpacity
key={i}
style={styles.cellContainer}
activeOpacity={1}
onPress={() => {
this.props.onPressVipBannerItem && this.props.onPressVipBannerItem(item.get('url'), i + 1);
}}>
<YH_Image url={url} style={styles.image} />
<Text style={styles.text}>{item.get('title')}</Text>
</TouchableOpacity>
);
})}
<View style={[styles.vLine1, {height: listHeight}]} />
<View style={[styles.vLine2, {height: listHeight}]} />
<View style={[styles.vLine3, {height: listHeight}]} />
<View style={styles.hLine1} />
<View style={styles.hLine2} />
</View>
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let cellWidth = width / 4-0.5;
let cellWidth = width / 4;
let imageWidth = cellWidth - 14 * 2;
let imageHeight = imageWidth * 168 / 126;
let cellHeight = imageHeight + 20;
const styles = StyleSheet.create({
line: {
height: 0.5,
backgroundColor: '#f7f7f7'
container: {
width: width,
flexDirection: 'column',
},
listContent: {
backgroundColor: '#e5e5e5',
list: {
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'flex-start',
alignItems: 'flex-start',
width:width,
},
cellContainer: {
backgroundColor: '#f5f7f6',
width:cellWidth,
justifyContent:'center',
height:cellHeight,
alignItems:'center',
marginRight:0.5,
marginBottom:0.5
flexDirection:'column'
},
image: {
width: imageWidth,
... ... @@ -104,5 +101,42 @@ const styles = StyleSheet.create({
textAlign: 'center',
width:cellWidth,
height:20
}
},
vLine1: {
position: 'absolute',
backgroundColor: '#e5e5e5',
width: 0.5,
top: 0,
left: cellWidth,
},
vLine2: {
position: 'absolute',
backgroundColor: '#e5e5e5',
width: 0.5,
top: 0,
left: cellWidth * 2,
},
vLine3: {
position: 'absolute',
backgroundColor: '#e5e5e5',
width: 0.5,
top: 0,
left: cellWidth * 3,
},
hLine1: {
position: 'absolute',
backgroundColor: '#e5e5e5',
width,
height: 0.5,
top: cellHeight,
left: 0,
},
hLine2: {
position: 'absolute',
backgroundColor: '#e5e5e5',
width,
height: 0.5,
top: cellHeight * 2,
left: 0,
},
});
... ...
... ... @@ -37,9 +37,10 @@ export default class RecommendContentThree extends React.Component {
let data = list.toArray();
let lineNumber = parseInt((data.length + 3) / 4);
let listHeight = Math.floor(lineNumber * imageHeight);
let containerHeight = bannerHeight + listHeight
return (
<View style={styles.container}>
<View style={[styles.container, {height: containerHeight}]}>
<ImageSlider
resource={big_image}
sliderWidth={width}
... ... @@ -68,7 +69,7 @@ export default class RecommendContentThree extends React.Component {
<View style={styles.hLine1} />
<View style={styles.hLine2} />
</View>
</View>
);
}
... ...
... ... @@ -109,6 +109,8 @@ export default class Home extends Component {
case 'favorite': {
let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal*1.5 : rowMarginHorizontal*2;
let customStyle = {paddingLeft};
let data = this._currentChannelData();
let similarIndex = data.get('similarIndex')
return (
<View style={[styles.product,]}>
<ProductListCell
... ... @@ -116,7 +118,11 @@ export default class Home extends Component {
key={'row' + rowID}
rowID={rowID}
data={rowData}
similarIndex={similarIndex}
onPressProduct={this.props.onPressProductListProduct}
onLongPressProduct={this.props.onLongPressProduct}
onPressFindSimilar={this.props.onPressFindSimilar}
onPressDislike={this.props.onPressDislike}
/>
</View>
);
... ... @@ -398,15 +404,24 @@ export default class Home extends Component {
_renderFooter() {
let data = this._currentChannelData();
let {isFetching, endReached, list, cached} = data;
let {isFetching, endReached, list, cached, favorite, isListFetching} = data;
let floorList = list.size > 0 ? list.toArray() : cached.get('list').toArray();
let isLoadingMore = !endReached && floorList.length != 0;
let isLoadingMore = false;
let animated = false;
if (this.props.channel == 4) {
isLoadingMore = !endReached && floorList.length != 0 && isListFetching;
animated = isListFetching;
} else {
isLoadingMore = !endReached && floorList.length != 0 && favorite.get('isFetching');
animated = favorite.get('isFetching');
}
return (
<LoadMoreIndicator
isVisible={isLoadingMore}
animating={isFetching}
animating={animated}
/>
);
}
... ...
... ... @@ -63,18 +63,18 @@ const DEVICE_WIDTH_RATIO = width / 375;
let styles = StyleSheet.create({
container: {
position: 'absolute',
left: 0,
left: 12*DEVICE_WIDTH_RATIO,
right: 12*DEVICE_WIDTH_RATIO,
bottom: 15*DEVICE_WIDTH_RATIO,
width,
width: width-24*DEVICE_WIDTH_RATIO,
height: 58*DEVICE_WIDTH_RATIO,
flex: 1,
flexDirection: 'row',
backgroundColor: 'transparent',
},
bgImage: {
position: 'absolute',
width,
width: width-24*DEVICE_WIDTH_RATIO,
height: 58*DEVICE_WIDTH_RATIO,
backgroundColor: 'transparent',
},
... ... @@ -84,7 +84,7 @@ let styles = StyleSheet.create({
width: 34*DEVICE_WIDTH_RATIO,
height: 44*DEVICE_WIDTH_RATIO,
alignSelf: 'center',
backgroundColor: 'red'
backgroundColor: 'transparent'
},
titleContainer: {
... ... @@ -106,6 +106,6 @@ let styles = StyleSheet.create({
downIcon: {
alignSelf: 'center',
marginLeft: 80*DEVICE_WIDTH_RATIO,
marginLeft: 50*DEVICE_WIDTH_RATIO,
},
})
... ...
... ... @@ -51,4 +51,5 @@ export default keyMirror({
HOME_RECOMMEND_PRODUCT_FAILURE: null,
HOME_RECOMMEND_PRODUCT_SELECTED: null,
SET_SIMILAR_PRODUCT_INDEX: null,
});
... ...
... ... @@ -70,6 +70,10 @@ class HomeContainer extends Component {
this.onPressTitleMore = this.onPressTitleMore.bind(this);
this.onClickSort = this.onClickSort.bind(this);
this.onClickRecommendProduct = this.onClickRecommendProduct.bind(this);
this.onLongPressProduct = this.onLongPressProduct.bind(this);
this.onPressFindSimilar = this.onPressFindSimilar.bind(this);
this.onPressDislike = this.onPressDislike.bind(this);
this.onPressProductListProduct = this.onPressProductListProduct.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'ChannelDidChangeEvent',
... ... @@ -78,35 +82,6 @@ class HomeContainer extends Component {
this.home && this.home.trigggePullToRefresh();
}
);
this.subscription2 = NativeAppEventEmitter.addListener(
'UserDidLoginEvent',
(reminder) => {
this.home && this.home.trigggePullToRefresh();
}
);
this.subscription3 = NativeAppEventEmitter.addListener(
'UserDidLogoutEvent',
(reminder) => {
this.home && this.home.trigggePullToRefresh();
}
);
this.subscription4 = NativeAppEventEmitter.addListener(
'ABTestDidChangeEvent',
(reminder) => {
this.home && this.home.trigggePullToRefresh();
}
);
this.subscription5 = NativeAppEventEmitter.addListener(
'UserDidRegisterEvent',
(reminder) => {
this.home && this.home.trigggePullToRefresh();
}
);
}
componentDidMount() {
... ... @@ -116,19 +91,45 @@ class HomeContainer extends Component {
componentWillUnmount() {
this.subscription && this.subscription.remove();
this.subscription2 && this.subscription2.remove();
this.subscription3 && this.subscription3.remove();
this.subscription4 && this.subscription4.remove();
this.subscription5 && this.subscription5.remove();
}
onLongPressProduct(rowID) {
if (rowID) {
this.props.actions.setSimilarIndex(rowID);
}
}
onPressFindSimilar(product) {
if (!product) {
return;
}
ReactNative.NativeModules.YH_CommonHelper.jumpFindSimilar(product);
}
onPressDislike() {
console.log('dislike....');
}
onPressProductListProduct(product, rowId=0) {
let productSkn = product && product.get('product_skn', 0);
if (!productSkn) {
return;
}
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
onRefresh() {
InteractionManager.runAfterInteractions(() => {
this.props.actions.fetchFloor();
});
}
onClickRecommendProduct() {
this.props.actions.selectedRecommendProduct();
}
onEndReached() {
InteractionManager.runAfterInteractions(() => {
this.props.actions.fetchHomeFavoriteList();
... ... @@ -219,7 +220,8 @@ class HomeContainer extends Component {
onPressVipProduct(productId,productSkn) {
ReactNative.NativeModules.YH_CommonHelper.jumpToProductDetail(productId.toString(), productSkn.toString());
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"${productSkn}"}}`;
this.jumpWithUrl(url);
}
onPressTitleMore(url, index) {
... ... @@ -230,10 +232,6 @@ class HomeContainer extends Component {
this.props.actions.selecLifeStyleProductIndex(index);
}
onClickRecommendProduct() {
this.props.actions.selectedRecommendProduct();
}
render() {
let {app, home} = this.props;
return (
... ... @@ -265,6 +263,10 @@ class HomeContainer extends Component {
onPressShopFavorite={this.onPressShopFavorite}
onPressTitleMore={this.onPressTitleMore}
onClickSort={this.onClickSort}
onLongPressProduct={this.onLongPressProduct}
onPressFindSimilar={this.onPressFindSimilar}
onPressDislike={this.onPressDislike}
onPressProductListProduct={this.onPressProductListProduct}
onClickRecommendProduct={this.onClickRecommendProduct}
/>
</View>
... ...
... ... @@ -44,6 +44,7 @@ const {
SHOP_FAV_CANCEL_REQUEST,
SHOP_FAV_CANCEL_SUCCESS,
SHOP_FAV_CANCEL_FAILURE,
SET_SIMILAR_PRODUCT_INDEX,
HOME_RECOMMEND_PRODUCT_REQUEST,
HOME_RECOMMEND_PRODUCT_SUCCESS,
... ... @@ -53,6 +54,17 @@ const {
} = require('../../constants/actionTypes').default;
export function setSimilarIndex(rowID) {
return (dispatch, getState) => {
let {app, home} = getState();
let channel = app.channel;
let channelStr = channelTransfer.number2String(channel);
dispatch( {
type: SET_SIMILAR_PRODUCT_INDEX,
payload: {channelStr, rowID},
});
}
}
/**
** 加载缓存
**/
... ... @@ -196,7 +208,8 @@ export function fetchBoyGirlFavoriteList() {
payload.list = newList;
}
//商品列表最多分四页
payload.endReached = (payload.currentPage > 4) || (payload.currentPage == payload.pageCount);
payload.endReached = (payload.list.length == 0)||((payload.currentPage > 4) || (payload.currentPage == payload.pageCount));
dispatch(fetchFavoriteSuccess(payload, channelStr));
... ... @@ -436,7 +449,7 @@ export function favoriteOperation(shopId) {
ReactNative.NativeModules.YH_CommonHelper.uid()
.then(uid => {
shopId = shopId + '';
let {app, home} = getState();
let channelStr = channelTransfer.number2String(app.channel);
let shopState = home[channelStr].shop.get('list');
... ...
... ... @@ -50,6 +50,7 @@ let templet = new (Record({
favorite: favorite, //男, 女,潮童频道 猜你喜欢列表
content_code: '',
endReached: false,
similarIndex: -1,
}));
let lifeStyle = new (Record({
... ... @@ -72,6 +73,7 @@ let lifeStyle = new (Record({
selectIndex: 0,
content_code: '',
similarIndex: -1,
}));
let InitialState = Record({
... ...
... ... @@ -41,6 +41,7 @@ const {
SHOP_FAV_CANCEL_REQUEST,
SHOP_FAV_CANCEL_SUCCESS,
SHOP_FAV_CANCEL_FAILURE,
SET_SIMILAR_PRODUCT_INDEX,
HOME_RECOMMEND_PRODUCT_REQUEST,
HOME_RECOMMEND_PRODUCT_SUCCESS,
... ... @@ -61,6 +62,11 @@ export default function homeReducer(state=initialState, action) {
let channelStr = action.payload;
return state.setIn([channelStr, 'isFetching'], true);
}
case SET_SIMILAR_PRODUCT_INDEX: {
let {channelStr, rowID} = action.payload;
let newState = state.setIn([channelStr, 'similarIndex'], rowID);
return newState;
}
case HOME_FLOOR_SUCCESS:{
let {channelStr, json} = action.payload;
return state.setIn([channelStr, 'isFetching'], false)
... ...
... ... @@ -82,8 +82,8 @@ class NewArrivalContainer extends Component {
}
}
_onPressFindSimilar() {
console.log('find similar');
_onPressFindSimilar(product) {
ReactNative.NativeModules.YH_CommonHelper.jumpFindSimilar(product);
}
_onPressDislike() {
... ...
... ... @@ -137,6 +137,7 @@ export default class ActivityCell extends React.Component {
let id = data.id;
let price = promotionName&&promotionName.length>2?promotionName.substring(0,promotionName.length-2):''
let priceString = promotionName&&promotionName.length>2?promotionName.substring(promotionName.length-2,promotionName.length):''
let startLeftTime = data.startLeftTime;
return (
<View style={styles.container}>
... ... @@ -144,8 +145,16 @@ export default class ActivityCell extends React.Component {
activeOpacity={1}
style={{width: backgroundWidth, height: backgroundHeight}}
onPress={() => {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.outletactivity","params":{"activity_id":"${id}"}}`;
this.props.onPressProduct && this.props.onPressProduct(url);
if (startLeftTime <= 0) {
if (this.state.showString == '活动已结束') {
this.props.showToast && this.props.showToast('活动已结束,敬请期待。');
}else {
let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.outletactivity","params":{"activity_id":"${id}"}}`;
this.props.onPressProduct && this.props.onPressProduct(url);
}
}else {
this.props.showToast && this.props.showToast('活动还未开始,敬请期待');
}
}}
>
<YH_Image
... ...
... ... @@ -24,6 +24,8 @@ export default class Outlet extends Component {
let {
categoryList,
isShowToast,
toastMessage,
} = this.props;
if (!categoryList) {
... ... @@ -44,6 +46,8 @@ export default class Outlet extends Component {
tabLabel={name}
key={'OutletPageListView' + i}
resource = {item}
toastMessage = {toastMessage}
isShowToast = {isShowToast}
getOutletHomeResource = {this.props.getOutletHomeResource}
getOutletActivityList = {this.props.getOutletActivityList}
onPressProduct = {this.props.onPressProduct}
... ... @@ -51,6 +55,8 @@ export default class Outlet extends Component {
setActivityFliter = {this.props.setActivityFliter}
onPressFilter = {this.props.onPressFilter}
onEndReached = {this.props.onEndReached}
showToast = {this.props.showToast}
hideToastMessage = {this.props.hideToastMessage}
/>
);
})}
... ...
... ... @@ -44,7 +44,7 @@ export default class OutletDoubleImage extends React.Component {
let url1 = data[1].url;
return (
<View style={styles.viewStyle}>
<TouchableOpacity onPress={() => {this.props.onPressProduct&&this.props.onPressProduct(src0)}} >
<TouchableOpacity onPress={() => {this.props.onPressProduct&&this.props.onPressProduct(url0)}} >
<YH_Image
url={src0}
style={styles.thumbnail}
... ...
... ... @@ -21,6 +21,7 @@ import ProductFliter from './ProductFliter';
import BrandProductListCell from '../../../common/components/ListCell/ProductListCell';
import ActivityCell from './ActivityCell';
import NoActivityView from './NoActivityView';
import Prompt from '../../../coupon/components/coupon/Prompt';
export default class OutletPageListView extends Component {
constructor(props) {
... ... @@ -100,7 +101,6 @@ export default class OutletPageListView extends Component {
}
renderRow(rowData, sectionID, rowID, highlightRow) {
// console.log(rowData.toJS());
if (sectionID == 'outletHomeReource') {
if (rowData.get('template_name') == 'NL2R') {
return(<OutletThreeImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
... ... @@ -108,7 +108,7 @@ export default class OutletPageListView extends Component {
return(<OutletSwiper resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}else if (rowData.get('template_name') == 'single_image') {
return(<OutletSingleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}else if (rowData.get('template_name') == 'double_image') {
}else if (rowData.get('template_name') == 'small_pic') {
return(<OutletDoubleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}else if (rowData.get('template_name') == 'recommend_content_five') {
return(<OutletRecommendFive resource={rowData} onPressProduct={this.props.onPressProduct}/>);
... ... @@ -118,7 +118,7 @@ export default class OutletPageListView extends Component {
// return(<TripleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
}
}else if (sectionID == 'activityList') {
return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} onPressProduct={this.props.onPressProduct}/>);
return(<ActivityCell resource={rowData} key = {rowID + 'activityList'} showToast={this.props.showToast} onPressProduct={this.props.onPressProduct}/>);
}else if (sectionID == 'activityMore') {
if (rowData == 'more') {
let sourceIcon = require('../../../brandStore/image/filter/brandstore_filter_arrow_down_normal.png');
... ... @@ -152,11 +152,16 @@ export default class OutletPageListView extends Component {
let {
resource,
tabLabel,
toastMessage,
isShowToast,
} = this.props;
if (!resource) {
return null;
}
let needShowToast = isShowToast;
let showToastMessage = toastMessage;
let title = tabLabel;
let isFetching_homeResource = resource.get('isFetching')?resource.get('isFetching'):false;
let honeResource = resource.get('honeResource');
... ... @@ -219,6 +224,11 @@ export default class OutletPageListView extends Component {
}
}}
/>
{needShowToast ? <Prompt
text={showToastMessage}
duration={3000}
onPromptHidden={this.props.hideToastMessage}
/> : null}
</View>
);
}
... ...
... ... @@ -7,10 +7,10 @@ export default keyMirror({
SET_CHANNEL: null,
SET_SERVICE_HOST: null,
SET_CATEGORYID: null,
HIDE_TOAST: null,
SET_ACTIVITY_FLITER: null,
SET_FLITER: null,
SHOW_TOAST: null,
GET_CATEGORY_REQUEST: null,
GET_CATEGORY_SUCCESS: null,
GET_CATEGORY_FAILURE: null,
... ...
... ... @@ -47,6 +47,8 @@ class OutletContainer extends Component {
this._getOutletActivityList = this._getOutletActivityList.bind(this);
this._onEndReached = this._onEndReached.bind(this);
this._setActivityFliter = this._setActivityFliter.bind(this);
this._showToast = this._showToast.bind(this);
this._hideToastMessage = this._hideToastMessage.bind(this);
}
componentDidMount() {
... ... @@ -89,6 +91,13 @@ class OutletContainer extends Component {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
}
_showToast(value){
this.props.actions.showToastMessage(value);
}
_hideToastMessage(){
this.props.actions.hideToastMessage();
}
_onPressFilter(content_code,value,categoryNavigationItem){
this.props.actions.onPressFilter(content_code,value);
... ... @@ -102,11 +111,15 @@ class OutletContainer extends Component {
let {
categoryList,
isShowToast,
toastMessage,
} = this.props.outlet;
return (
<Outlet
categoryList = {categoryList}
isShowToast = {isShowToast}
toastMessage = {toastMessage}
getOutletHomeResource = {this._getOutletHomeResource}
setActivityFliter = {this._setActivityFliter}
getOutletActivityList = {this._getOutletActivityList}
... ... @@ -114,6 +127,8 @@ class OutletContainer extends Component {
onPressProductListProduct = {this._onPressProductListProduct}
onPressFilter = {this._onPressFilter}
onEndReached = {this._onEndReached}
showToast = {this._showToast}
hideToastMessage = {this._hideToastMessage}
/>
);
}
... ...
... ... @@ -11,7 +11,8 @@ const {
SET_ACTIVITY_FLITER,
SET_FLITER,
SHOW_TOAST,
HIDE_TOAST,
GET_CATEGORY_REQUEST,
GET_CATEGORY_SUCCESS,
GET_CATEGORY_FAILURE,
... ... @@ -261,3 +262,17 @@ export function onPressFilter(content_code,value) {
payload: {'value':value,'content_code':content_code}
};
}
export function showToastMessage(value) {
return {
type: SHOW_TOAST,
payload: value
};
}
export function hideToastMessage() {
return {
type: HIDE_TOAST,
};
}
... ...
... ... @@ -9,6 +9,8 @@ let InitialState = Record({
error: null,
list: List(),
})),
isShowToast: false,
toastMessage: '',
});
export default InitialState;
... ...
... ... @@ -6,7 +6,8 @@ import Immutable, {Map} from 'immutable';
const {
SET_ACTIVITY_FLITER,
SET_FLITER,
SHOW_TOAST,
HIDE_TOAST,
GET_CATEGORY_REQUEST,
GET_CATEGORY_SUCCESS,
GET_CATEGORY_FAILURE,
... ... @@ -219,6 +220,10 @@ export default function outletReducer(state=initialState, action) {
})
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
}
case SHOW_TOAST:
return state.set('isShowToast', true).set('toastMessage', action.payload)
case HIDE_TOAST:
return state.set('isShowToast', false).set('toastMessage', '')
}
return state;
... ...
... ... @@ -213,7 +213,7 @@ let styles = StyleSheet.create({
height: imageHeigth,
position: 'absolute',
marginTop: -imageHeigth,
backgroundColor: 'rgba(0,0,0,.2)'
backgroundColor: 'rgba(0,0,0,.15)'
},
header: {
justifyContent: 'flex-end',
... ...