Authored by 张文文

修改种草消息tab切小红点数字 reviewd by 朱傲哲

... ... @@ -18,11 +18,19 @@ export default class ContentListView extends Component {
super(props);
this._renderRow = this._renderRow.bind(this);
this._renderFooter = this._renderFooter.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_renderFooter(){
return (
<View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}>
</View>
)
}
_renderRow(rowData, sectionID, rowID) {
return (
... ... @@ -76,6 +84,7 @@ export default class ContentListView extends Component {
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRows(contentList)}
renderRow={this._renderRow}
renderFooter={this._renderFooter}
enableEmptySections={true}
enablePullToRefresh={true}
isOnPullToRefresh={isPullToRefresh}
... ... @@ -96,6 +105,7 @@ export default class ContentListView extends Component {
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRows(contentList)}
renderRow={this._renderRow}
renderFooter={this._renderFooter}
enableEmptySections={true}
enablePullToRefresh={true}
refreshControl={
... ...
... ... @@ -18,6 +18,7 @@ export default class ContentMessageView extends Component {
this._renderRow = this._renderRow.bind(this);
this._renderHeader = this._renderHeader.bind(this);
this._renderFooter = this._renderFooter.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
... ... @@ -42,10 +43,6 @@ export default class ContentMessageView extends Component {
NativeModules.YH_CommonHelper.jumpToUpdateNotificationStatus();
}
function onPress(actionUrl) {
NativeModules.YH_CommonHelper.jumpWithUrl(actionUrl);
}
return (<View>
{showStatus ?
<View style={styles.tipContainer}>
... ... @@ -62,7 +59,7 @@ export default class ContentMessageView extends Component {
<View style={styles.tabContainer}>
{this.props.tabButtons.map((button, index)=> {
return <TouchableOpacity style={styles.tabItemContainer} key={index} onPress={()=> {
onPress(button.actionUrl)
this.props.onPressTabAction && this.props.onPressTabAction(button.actionUrl, button.type);
}}>
<ContentMessageTabView icon={button.icon} title={button.description} badge={button.unReadCount}/>
</TouchableOpacity>
... ... @@ -73,6 +70,13 @@ export default class ContentMessageView extends Component {
)
}
_renderFooter(){
return (
<View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}>
</View>
)
}
render() {
let commentList = this.props.commentList;
let isPullToRefresh = this.props.isPullToRefresh;
... ... @@ -91,6 +95,7 @@ export default class ContentMessageView extends Component {
dataSource={this.dataSource.cloneWithRows(commentList)}
renderRow={this._renderRow}
renderHeader={this._renderHeader}
renderFooter={this._renderFooter}
enableEmptySections={true}
enablePullToRefresh={true}
isOnPullToRefresh={isPullToRefresh}
... ... @@ -112,6 +117,7 @@ export default class ContentMessageView extends Component {
dataSource={this.dataSource.cloneWithRows(commentList)}
renderRow={this._renderRow}
renderHeader={this._renderHeader}
renderFooter={this._renderFooter}
enableEmptySections={true}
enablePullToRefresh={true}
refreshControl={
... ...
... ... @@ -56,4 +56,5 @@ export default keyMirror({
MESSAGE_CLEAR_OTHER_LIST: null,
MESSAGE_CLEAR_COMMENT_LIST: null,
CLEAR_BADGE_NUM_SUCCESS: null,
});
... ...
... ... @@ -57,6 +57,7 @@ class ContentMessageContainer extends Component {
this._jumpToShowKeyboard = this._jumpToShowKeyboard.bind(this);
this._jumpToPersonalGrassPage = this._jumpToPersonalGrassPage.bind(this);
this._jumpToGrassDetailPage = this._jumpToGrassDetailPage.bind(this);
this._onPressTabAction = this._onPressTabAction.bind(this);
}
componentDidMount() {
... ... @@ -92,6 +93,12 @@ class ContentMessageContainer extends Component {
this.props.actions.hiddenTipMessage();
}
_onPressTabAction(actionUrl, tabType) {
this.props.actions.clearBadgeNumAction(tabType);
NativeModules.YH_CommonHelper.jumpWithUrl(actionUrl);
}
_jumpToShowKeyboard(dataSource) {
this.setState({
dataSource: dataSource,
... ... @@ -183,6 +190,7 @@ class ContentMessageContainer extends Component {
jumpToShowKeyboard={this._jumpToShowKeyboard}
jumpToPersonalGrassPage={this._jumpToPersonalGrassPage}
jumpToGrassDetailPage={this._jumpToGrassDetailPage}
onPressTabAction={this._onPressTabAction}
/>
</View>
)
... ...
... ... @@ -37,6 +37,8 @@ const {
SHOW_REPLY_TIP_MESSAGE,
HIDDEN_REPLY_TIP_MESSAGE,
CLEAR_BADGE_NUM_SUCCESS,
} = require('../../constants/actionTypes').default;
export function setContentListId(id) {
... ... @@ -171,6 +173,13 @@ export function hiddenTipMessage() {
}
}
export function clearBadgeNumAction(tabType) {
return {
type:CLEAR_BADGE_NUM_SUCCESS,
payload: tabType,
}
}
/*
* 获取通知类型
... ...
... ... @@ -34,6 +34,8 @@ const {
SHOW_REPLY_TIP_MESSAGE,
HIDDEN_REPLY_TIP_MESSAGE,
CLEAR_BADGE_NUM_SUCCESS,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -85,18 +87,6 @@ export default function grassReducer(state=initialState, action) {
.setIn([getContentListObject(action.isLatest), 'pageCount'], action.payload.pageCount)
.setIn([getContentListObject(action.isLatest), 'shouldShowEmpty'], action.payload.shouldShowEmpty)
if (!action.isLatest) {
let list = state.contentType.get('list').toJS();
return state.setIn(['contentType', 'list'], Immutable.fromJS(list.map((item)=> {
if (item.type == action.payload.type) {
return Object.assign({}, item, {
unReadCount: 0
})
}
return item;
})))
}
return state;
}
... ... @@ -159,6 +149,18 @@ export default function grassReducer(state=initialState, action) {
return state.set('tipMessage', '');
}
case CLEAR_BADGE_NUM_SUCCESS: {
let typeList = state.contentType.get('list').toJS();
return state.setIn(['contentType', 'list'], Immutable.fromJS(typeList.map((item)=> {
if (item.type == action.payload) {
return Object.assign({}, item, {
unReadCount: 0
})
}
return item;
})));
}
}
return state;
}
... ...