Authored by 陈林

Merge commit '983d3c88' into V6.8.9

... ... @@ -18,9 +18,11 @@ import {Record, List, Map} from 'immutable';
import appInitialState from './reducers/app/appInitialState';
import messageInitialState from './reducers/message/messageInitialState';
import listInitialState from './reducers/list/listInitialState';
import contentInitialState from './reducers/content/contentInitialState';
import MessageContainer from './containers/MessageContainer';
import MessageListContainer from './containers/MessageListContainer';
import ContentMessageContainer from './containers/ContentMessageContainer';
import {
setPlatform,
... ... @@ -33,12 +35,19 @@ import {
setCategoryName,
} from './reducers/list/listActions';
import {
setContentListId,
setContentCategoryName,
setContentTipFlag
} from './reducers/content/contentActions';
function getInitialState() {
const _initState = {
app: (new appInitialState()),
message: (new messageInitialState()),
list: (new listInitialState()),
content: (new contentInitialState()),
};
return _initState;
}
... ... @@ -48,7 +57,7 @@ export default function native(platform) {
let YH_Message = createReactClass({
render() {
const store = configureStore(getInitialState());
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
store.dispatch(setHost(this.props.host));
store.dispatch(setServiceHost(this.props.serviceHost));
... ... @@ -68,6 +77,15 @@ export default function native(platform) {
<MessageListContainer />
</Provider>
);
} else if (type == 'content') {
store.dispatch(setContentListId(this.props.listId));
store.dispatch(setContentCategoryName(this.props.categoryName));
store.dispatch(setContentTipFlag(this.props.tipFlag));
return (
<Provider store={store}>
<ContentMessageContainer />
</Provider>
);
}
return null;
}
... ...
/**
* Created by zzz on 2019/3/12.
*/
'use strict';
import React, {Component} from 'react';
import {Dimensions, Image, StyleSheet, Text, TouchableOpacity, View, NativeModules} from 'react-native';
import {Immutable} from "immutable";
import YH_Image from '../../../common/components/YH_Image';
export default class ContentFansListCell extends Component {
constructor(props) {
super(props);
}
render() {
let ico = 'http://head.static.yhbimg.com/yhb-head/2018/07/02/16/01fc258bbe83d5b332f3b2631897b80ec9.591188.jpg?imageView2/{mode}/w/{width}/h/{height}';
let imageUrl = YH_Image.getSlicedUrl(ico, 50, 50, 2);
function onHeadIconPress() {
console.log('onHeadIconPress');
}
function onFanPress() {
console.log('onFanPress');
}
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> {onHeadIconPress()}}>
<YH_Image style={styles.headIcon} url={imageUrl} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<Text>
<Text style={styles.nicknameText}>PINKA</Text>
<Text style={styles.defaultReplyText} numberOfLines={2}> 关注了你</Text>
</Text>
<Text style={styles.startTimeText}>{'2018.03.05 10:00:00'}</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.fanContainer} onPress={()=> {onFanPress()}}>
<Image style={styles.fanImage} source={require('../../images/content_fan.png')}/>
</TouchableOpacity>
</View>
<View style={styles.lineView}/>
</View>
);
}
}
let { width, height } = Dimensions.get('window');
const DEVICE_HEIGHT_RATIO = height / 667;
let styles = StyleSheet.create({
headerBackground: {
width: width,
height: 80,
backgroundColor: 'white',
flexDirection: 'row',
},
headIcon: {
width: 50,
height: 50,
marginLeft: 15,
marginTop: 15,
marginRight:15,
overflow: 'hidden',
borderRadius: 25,
},
textView: {
flexDirection: 'column',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginTop: 15,
marginBottom: 20,
},
startTimeText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#B0B0B0',
height: 17
},
nicknameText: {
fontSize: 14,
fontFamily: 'PingFang-SC-Medium',
color: 'black',
fontWeight: 'bold'
},
fanContainer: {
position: 'absolute',
top: 27,
right: 15,
width: 60,
height: 25,
},
fanImage: {
width: 60,
height: 25,
},
lineView: {
marginLeft:15,
marginRight: 0,
width: width-15,
height: 1,
backgroundColor: '#e0e0e0'
},
});
... ...
/**
* Created by zzz on 2019/3/12.
*/
'use strict';
import React, {Component} from 'react';
import {Dimensions, Image, ListView, StyleSheet, Text, TouchableOpacity, View, NativeModules} from 'react-native';
import {Immutable} from "immutable";
import YH_Image from '../../../common/components/YH_Image';
export default class ContentLikedListCell extends Component {
constructor(props) {
super(props);
}
render() {
let ico = 'http://head.static.yhbimg.com/yhb-head/2018/07/02/16/01fc258bbe83d5b332f3b2631897b80ec9.591188.jpg?imageView2/{mode}/w/{width}/h/{height}';
let picUrl = 'http://img10.static.yhbimg.com/unionimg/2018/09/11/16/012d77a863813f5789f7b9cb92a561ec87.jpg';
let imageUrl = YH_Image.getSlicedUrl(ico, 50, 50, 2);
function onHeadIconPress() {
}
function onOriginPress() {
}
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> {onHeadIconPress()}}>
<YH_Image style={styles.headIcon} url={imageUrl} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<Text style={styles.nicknameText}>社区用户昵称</Text>
<Text style={styles.subnameText}>赞了你</Text>
</View>
</View>
<TouchableOpacity activeOpacity={1} onPress={() => {onOriginPress()}}>
<View style={ styles.originView} >
<Text style={styles.copyText}>原文</Text>
<YH_Image url={picUrl} style={styles.imageStyle} />
<Text style={styles.originText} numberOfLines={1}>这款Acne Studios 推出全新「The Johnny Winter Project」系列的东西很好很不错呢,我也很喜欢,太棒了</Text>
</View>
</TouchableOpacity>
<View style={styles.timeView}>
<Text style={styles.startTimeText}>{'2018.03.05'}</Text>
</View>
<View style={styles.lineView}/>
</View>
);
}
}
let { width, height } = Dimensions.get('window');
const DEVICE_HEIGHT_RATIO = height / 667;
let styles = StyleSheet.create({
headerBackground: {
width: width,
height: 70,
backgroundColor: 'white',
flexDirection: 'row',
},
headIcon: {
width: 40,
height: 40,
marginLeft: 15,
marginTop: 15,
marginRight:10,
overflow: 'hidden',
borderRadius: 20,
},
textView: {
flexDirection: 'column',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginTop: 18,
marginBottom: 15,
},
nicknameText: {
fontSize: 14,
fontFamily: 'PingFang-SC-Medium',
color: '#222222',
},
subnameText: {
fontSize: 12,
fontFamily: 'PingFang-SC-Regular',
color: '#B0B0B0',
},
originView: {
flex: 1,
marginLeft: 15,
marginRight: 15,
marginBottom: 10,
backgroundColor: '#f0f0f0'
},
copyText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#444444',
marginTop: 10,
marginLeft: 10,
},
imageStyle: {
marginTop: 10,
marginBottom: 4,
marginLeft: 10,
width: 50 * DEVICE_HEIGHT_RATIO,
height: 50 * DEVICE_HEIGHT_RATIO,
},
originText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#b0b0b0',
marginLeft: 10,
marginRight: 15,
marginBottom: 9,
},
timeView: {
alignItems: 'flex-start',
marginBottom: 10,
marginLeft: 15,
},
startTimeText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#B0B0B0',
height: 17
},
lineView: {
marginLeft:15,
marginRight: 0,
width: width-15,
height: 1,
backgroundColor: '#e0e0e0'
},
});
... ...
/**
* Created by zzz on 2019/3/12.
*/
'use strict';
import React, {Component} from 'react';
import {DeviceEventEmitter, Dimensions, Image, ListView, StyleSheet, Text, TouchableOpacity, View, NativeModules} from 'react-native';
import {Immutable} from "immutable";
import YH_Image from '../../../common/components/YH_Image';
export default class ContentMessageCellView extends Component {
constructor(props) {
super(props);
}
render() {
let ico = 'http://head.static.yhbimg.com/yhb-head/2018/07/02/16/01fc258bbe83d5b332f3b2631897b80ec9.591188.jpg?imageView2/{mode}/w/{width}/h/{height}';
let picUrl = 'http://img10.static.yhbimg.com/unionimg/2018/09/11/16/012d77a863813f5789f7b9cb92a561ec87.jpg';
let imageUrl = YH_Image.getSlicedUrl(ico, 50, 50, 2);
let status = true;
function onReplyPress() {
// NativeModules.YH_CommonHelper.showkeyBoardView();
}
return (
<View>
<View style={styles.headerBackground}>
<YH_Image style={styles.headIcon} url={imageUrl} circle={true}/>
<View style={styles.textView}>
<Text style={styles.nicknameText}>社区用户昵称</Text>
<Text style={styles.subnameText}>赞了你</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.replyContainer} onPress={()=> {onReplyPress()}}>
<Image style={styles.replyImage} source={require('../../images/content_reply.png')}/>
</TouchableOpacity>
</View>
<View style={styles.replyTextView}>
<Text style={styles.replyText} numberOfLines={2}>这款Acne Studios 推出全新「The Johnny Winter Project」系列的东西很好很不错呢,我也很喜欢,太棒了</Text>
</View>
{ status ?
<View style={styles.ownerReplyView}>
<Text style={{paddingLeft: 10, paddingTop: 14, paddingRight: 1, paddingBottom: 12}}>
<Text style={styles.replyText}>我的评论:</Text>
<Text style={styles.defaultReplyText} numberOfLines={2}>送你一颗小心心,这个鞋子也是我很想入的一款。非常酷棒极了,详情具体关注你的后续文章</Text>
</Text>
</View>
:
<TouchableOpacity activeOpacity={1} onPress={() => {}}>
<View style={ styles.originContainerView} >
<Text style={styles.copyText}>原文</Text>
<YH_Image url={picUrl} style={styles.imageStyle} />
<Text style={styles.originText} numberOfLines={1}>这款Acne Studios 推出全新「The Johnny Winter Project」系列的东西很好很不错呢,我也很喜欢,太棒了</Text>
</View>
</TouchableOpacity> }
<View style={styles.timeView}>
<Text style={styles.startTimeText}>{'2018.03.05'}</Text>
</View>
<View style={styles.lineView}/>
</View>
);
}
}
let { width, height } = Dimensions.get('window');
const DEVICE_WIDTH_RATIO = width / 375;
const DEVICE_HEIGHT_RATIO = height / 667;
let styles = StyleSheet.create({
headerBackground: {
width: width,
height: 70,
backgroundColor: 'white',
flexDirection: 'row',
},
headIcon: {
width: 40,
height: 40,
marginLeft: 15,
marginTop: 15,
marginRight:10,
overflow: 'hidden',
borderRadius: 20,
},
textView: {
flexDirection: 'column',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginTop: 18,
marginBottom: 15,
},
nicknameText: {
fontSize: 14,
fontFamily: 'PingFang-SC-Medium',
color: '#222222',
},
subnameText: {
fontSize: 12,
fontFamily: 'PingFang-SC-Regular',
color: '#B0B0B0',
},
replyContainer: {
position: 'absolute',
top: 23,
right: 15,
width: 60,
height: 25,
},
replyImage: {
width: 60,
height: 25,
},
replyTextView: {
width: width - 30,
marginBottom: 15,
marginLeft: 15,
},
replyText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#444444',
},
ownerReplyView : {
flexDirection: 'row',
alignItems: 'center',
width: width - 30,
marginLeft: 15,
backgroundColor: '#F0F0F0',
marginBottom: 10,
},
defaultReplyText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#a8a8a8',
},
originContainerView: {
flex: 1,
marginLeft: 15,
marginRight: 15,
marginBottom: 10,
backgroundColor: '#f0f0f0'
},
copyText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#444444',
marginTop: 10,
marginLeft: 9,
},
imageStyle: {
marginTop: 10,
marginBottom: 4,
marginLeft: 9,
width: 50 * DEVICE_HEIGHT_RATIO,
height: 50 * DEVICE_HEIGHT_RATIO,
},
originText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#b0b0b0',
marginLeft: 9,
marginRight: 16,
marginBottom: 9,
},
timeView: {
alignItems: 'flex-start',
marginBottom: 10,
marginLeft: 15,
},
startTimeText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#B0B0B0',
height: 17
},
lineView: {
marginLeft:15,
marginRight: 0,
width: width-15,
height: 1,
backgroundColor: '#e0e0e0'
},
});
... ...
/**
* Created by zzz on 2019/3/5.
*/
'use strict';
import React, {Component} from "react";
import {StyleSheet, Text, View, Image, ART} from "react-native";
import YH_Image from "../../../common/components/YH_Image";
const {Path, Shape, Surface, Group} = ART;
const INVALID_POSITION = -1;
const IMAGE_WIDTH = 50;
const IMAGE_HEIGHT = 50;
export default class ContentMessageTabView extends Component {
constructor(props) {
super(props);
this.state = {
badgeX: INVALID_POSITION,
badgeY: INVALID_POSITION,
badgeWidth: INVALID_POSITION,
badgeHeight: INVALID_POSITION
};
this.onImageLayout = this.onImageLayout.bind(this)
this.onBadgeLayout = this.onBadgeLayout.bind(this)
}
onImageLayout(event) {
let imageLayout = event.nativeEvent.layout
this.setState({
badgeY: imageLayout.y - 4,
badgeX: imageLayout.x + imageLayout.width / 2 + 17,
})
}
onBadgeLayout(event) {
let badgeLayout = event.nativeEvent.layout
this.setState({badgeWidth: badgeLayout.width, badgeHeight: badgeLayout.height})
}
renderSurface() {
if (this.state.badgeWidth != INVALID_POSITION && this.state.badgeHeight != INVALID_POSITION) {
let width = this.state.badgeWidth, height = this.state.badgeHeight
let strokeWidth = 1.5
const radius = (height - strokeWidth) / 2, x = strokeWidth / 2 + radius, y = (height) / 2;
const path = new Path()
.moveTo(x, y - radius)
.counterArc(0, radius * 2, radius)
.lineTo(width - radius - strokeWidth / 2, y + radius)
.counterArc(0, -radius * 2, radius).close();
return <View style={styles.surfaceContainer}>
<Surface width={width} height={height}>
<Group>
<Shape d={path} stroke={'#FB2330'} fill={'#FB2330'} strokeWidth={strokeWidth}/>
</Group>
</Surface>
</View>
}
return null;
}
render() {
return <View style={[styles.container, this.props.style]}>
<Image style={styles.icon} source={this.props.icon} onLayout={this.onImageLayout}/>
<Text style={styles.title}>{this.props.title}</Text>
{this.props.badge > 0 && this.state.badgeX != INVALID_POSITION && this.state.badgeY != INVALID_POSITION &&
<View style={[styles.badgeContainer, {left: this.state.badgeX, top: this.state.badgeY}]}
onLayout={this.onBadgeLayout}>
{this.renderSurface()}
<Text style={styles.badgeTitle}>{this.props.badge}</Text>
</View>
}
</View>
}
}
let styles = StyleSheet.create({
container: {
marginTop: 33,
marginBottom: 40,
flexDirection: 'column',
justifyContent: 'center',
paddingLeft: 30,
paddingRight: 30,
},
title: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 14,
marginTop: 15,
color: '#4A4A4A',
textAlign:'center',
},
icon: {
width: 50,
height: 50,
},
badgeContainer: {
backgroundColor: 'transparent',
height: 17,
minWidth: 17,
alignItems: 'center',
justifyContent: 'center',
flex: 0,
position: 'absolute'
},
surfaceContainer: {
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
},
badgeTitle: {
marginLeft: 5,
marginRight: 5,
fontSize: 10,
color: 'white',
fontWeight: 'bold',
}
});
... ...
/**
* Created by zzz on 2019/3/5.
*/
'use strict';
import React, {Component} from "react";
import ReactNative, {View, Text, Image, ListView, StyleSheet, Dimensions, TouchableOpacity, Platform, RefreshControl, NativeModules
} from 'react-native';
import YH_PtrRefresh from '../../../common/components/YH_PtrRefresh';
import ContentMessageTabView from "./ContentMessageTabView";
import ContentMessageCell from "./ContentMessageCell";
export default class ContentMessageView extends Component {
constructor(props) {
super(props);
this._renderRow = this._renderRow.bind(this);
this._renderHeader = this._renderHeader.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderRow(rowData, sectionID, rowID) {
return (
<ContentMessageCell
key={'row'+ rowID}
data={rowData}
/>
);
}
_renderHeader() {
let tipHeight = this.props.contentTipFlag==='0'?40:0;
let lineHeight = this.props.contentTipFlag==='0'?1:0;
let buttonHeight = this.props.contentTipFlag==='0'?25:0;
let tabButtons = [{
imgSource: require('../../images/content_zan.png'),
type: 1,
description: "获赞收藏",
unReadCount: 0
}, {
imgSource: require('../../images/content_gz.png'),
type: 2,
description: "关注",
unReadCount: 2
}, {
imgSource: require('../../images/content_tz.png'),
type: 3,
description: "通知",
unReadCount: 0
}];
function onNotifyPress() {
NativeModules.YH_CommonHelper.jumpToUpdateNotificationStatus();
}
function onPress(description, messageType) {
}
return (<View>
<View style={[styles.tipContainer,{height: tipHeight}]}>
<Text style={[styles.tipStyle]}>{'开启推送通知,第一时间收到互动消息'}</Text>
<TouchableOpacity style={{width:60, height: buttonHeight}} onPress={()=> {onNotifyPress()}}>
<Image style={styles.openImage} source={require('../../images/open_btn.png')}/>
</TouchableOpacity>
<View style={{backgroundColor: '#EEEEEE', left: 0, right: 0, bottom: 0, position: 'absolute', height: lineHeight}}/>
</View>
<View style={styles.tabContainer}>
{tabButtons.map((button, index)=> {
return <TouchableOpacity style={styles.tabItemContainer} key={index} onPress={()=> {
onPress(button.description, button.type)
}}>
<ContentMessageTabView icon={button.imgSource} title={button.description} badge={button.unReadCount}/>
</TouchableOpacity>
})}
</View>
<View style={{backgroundColor: '#F0F0F0', left: 0, right: 0, bottom: 0, position: 'absolute', height: 10}}/>
</View>
)
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
render() {
let listData = [{
date: 1542598633,
inviterUid: 500031912,
uid: 500027570,
orderAmount: 0.00,
dateStr: "2018.11.19",
name: "********27242140",
orderNum: 0,
orderAmountStr: "¥0.00"
}, {
date: 1539584520,
inviterUid: 500031912,
uid: 600032910,
orderAmount: 0.00,
dateStr: "2018.10.15",
name: "YOHO-1c3da9037",
orderNum: 0,
orderAmountStr: "¥0.00"
}];
return (
<View style={styles.container}>
{
Platform.OS === 'ios' ?
<ListView
ref={(c) => {
this.listView = c;
}}
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRows(listData)}
renderRow={this._renderRow}
renderHeader={this._renderHeader}
enableEmptySections={true}
enablePullToRefresh={true}
// isOnPullToRefresh={isPullToRefresh}
// onRefreshData={() => {
// this.props.onRefresh && this.props.onRefresh();
// }}
/>
:
<ListView
ref={(c) => {
this.listView = c;
}}
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRows(listData)}
renderRow={this._renderRow}
renderHeader={this._renderHeader}
enableEmptySections={true}
enablePullToRefresh={true}
// refreshControl={
// <YH_PtrRefresh
// refreshing={isPullToRefresh}
// onRefresh={() => {
// this.props.onRefresh && this.props.onRefresh();
// }}
// colors={['#000000', '#ff0000']}
// progressBackgroundColor="#ffffff"
// />
// }
/>
}
</View>
);
}
}
let {width} = Dimensions.get('window');
const ROW_COLUMN = 3
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
contentContainer: {
},
tabContainer: {
flex: 1,
flexDirection: 'row',
flexWrap: 'wrap',
backgroundColor: 'white'
},
tabItemContainer: {
width: width / ROW_COLUMN,
alignItems: 'center',
justifyContent: 'center',
},
sectionTitle: {
fontWeight: 'bold',
fontSize: 20,
marginTop: 10,
marginBottom: 10,
marginLeft: 20,
color: 'black',
},
sectionContainer: {
backgroundColor: 'white',
},
emptyContainer: {
marginTop: 56,
alignItems: 'center',
justifyContent: 'center',
},
emptyTitle: {
fontWeight: 'bold',
fontSize: 24,
color: '#CCCCCC'
},
tipContainer: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#ffffff',
justifyContent: 'space-between',
paddingLeft: 11,
paddingRight: 14,
},
tipStyle: {
fontFamily: 'PingFang-SC-Medium',
fontSize: 14,
color: '#4A4A4A',
backgroundColor: 'transparent',
textAlign: 'center',
},
openImage: {
width: 60,
height: 25,
marginRight: 14
},
line: {
backgroundColor: '#EEEEEE',
left: 0,
right: 0,
bottom: 0,
position: 'absolute'
},
})
... ...
... ... @@ -26,4 +26,9 @@ export default keyMirror({
MESSAGE_LIST_CHANGE_EDIT_STATUS: null,
MESSAGE_LIST_CHANGE_SELECTED_STATUS: null,
//内容消息
SET_CONTENT_LIST_ID: null,
SET_CONTENT_CATEGORY_NAME: null,
SET_CONTENT_TIP_FLAG: null,
});
... ...
/**
* Created by zzz on 2019/3/5.
*/
'use strict'
import React, {Component} from "react";
import ReactNative, { StyleSheet, Dimensions, Platform, View, Text, NativeModules, InteractionManager, NativeAppEventEmitter,
} from 'react-native'
import {bindActionCreators} from "redux";
import {connect} from "react-redux";
import {Map} from "immutable";
import * as contentActions from "../reducers/content/contentActions";
import ContentMessageView from '../components/content/ContentMessageView';
const actions = [
contentActions,
]
function mapStateToProps(state) {
return {
contentTipFlag: state.content.contentTipFlag,
};
}
function mapDispatchToProps(dispatch) {
const creators = Map()
.merge(...actions)
.filter(value => typeof value === 'function')
.toObject();
return {
actions: bindActionCreators(creators, dispatch),
dispatch
};
}
class ContentMessageContainer extends Component {
constructor(props) {
super(props);
this._onEndReached = this._onEndReached.bind(this);
}
componentDidMount() {
}
componentWillUnmount() {
}
onRefresh() {
}
_onEndReached() {
}
render() {
let {
contentTipFlag,
} = this.props
let isFetching = false;
return (
<View style={styles.container}>
<ContentMessageView
ref={(view) => {
this.messageView = view
}}
contentTipFlag={contentTipFlag}/>
</View>
)
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default connect(mapStateToProps, mapDispatchToProps, null, {withRef: true})(ContentMessageContainer)
... ...
'use strict';
import ReactNative from 'react-native';
import ContentService from '../../services/ContentService';
import Moment from "moment";
const {
SET_CONTENT_LIST_ID,
SET_CONTENT_CATEGORY_NAME,
SET_CONTENT_TIP_FLAG,
} = require('../../constants/actionTypes').default;
export function setContentListId(id) {
return {
type: SET_CONTENT_LIST_ID,
payload: id,
};
}
export function setContentCategoryName(name) {
return {
type: SET_CONTENT_CATEGORY_NAME,
payload: name,
};
}
export function setContentTipFlag(value) {
return {
type: SET_CONTENT_TIP_FLAG,
payload: value,
};
}
... ...
'use strict';
import Immutable, {Record, List, Map} from 'immutable';
let InitialState = Record({
contentListId: 0,
contentCategoryName: '',
contentTipFlag: 0,
});
export default InitialState;
... ...
'use strict';
import InitialState from './contentInitialState';
import Immutable, {Map} from 'immutable';
const {
SET_CONTENT_LIST_ID,
SET_CONTENT_CATEGORY_NAME,
SET_CONTENT_TIP_FLAG,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
export default function grassReducer(state=initialState, action) {
switch(action.type) {
case SET_CONTENT_LIST_ID: {
return state.set('contentListId', action.payload);
}
case SET_CONTENT_CATEGORY_NAME: {
return state.set('contentCategoryName', action.payload);
}
case SET_CONTENT_TIP_FLAG: {
return state.set('contentTipFlag', action.payload);
}
}
return state;
}
... ...
... ... @@ -2,11 +2,13 @@ import {combineReducers} from 'redux';
import app from './app/appReducer';
import message from './message/messageReducer';
import list from './list/listReducer';
import content from './content/contentReducer';
const rootReducer = combineReducers({
app,
message,
list,
content
});
export default rootReducer;
... ...
'use strict';
import Request from '../../common/services/NativeRequest';
export default class ContentService {
constructor (host) {
let baseURL = 'http://api.yoho.cn';
if(host){
baseURL = host;
}
this.api = new Request(baseURL);
}
}
... ...