mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-20 03:42:10 +03:00
Fix for #561
This commit is contained in:
parent
264f7a8945
commit
8ea51e5aa2
@ -35,6 +35,7 @@ class NotificationView extends PureComponent {
|
||||
{ key: 'mentions', value: 'MENTIONS' },
|
||||
{ key: 'follows', value: 'FOLLOWS' },
|
||||
{ key: 'reblogs', value: 'REBLOGS' },
|
||||
{ key: 'transfers', value: 'TRANSFERS' },
|
||||
],
|
||||
selectedFilter: null,
|
||||
};
|
||||
@ -45,10 +46,11 @@ class NotificationView extends PureComponent {
|
||||
// Component Functions
|
||||
|
||||
_handleOnDropdownSelect = (index) => {
|
||||
const { getActivities } = this.props;
|
||||
const { getActivities, changeSelectedFilter } = this.props;
|
||||
const { filters } = this.state;
|
||||
|
||||
this.setState({ selectedFilter: filters[index].key });
|
||||
changeSelectedFilter(filters[index].key);
|
||||
getActivities(filters[index].key, false);
|
||||
};
|
||||
|
||||
|
@ -144,6 +144,9 @@ export const getActivities = data => new Promise((resolve, reject) => {
|
||||
case 'reblogs':
|
||||
url = `/reblogs/${data.user}`;
|
||||
break;
|
||||
case 'transfers':
|
||||
url = `/transfers/${data.user}`;
|
||||
break;
|
||||
default:
|
||||
url = `/activities/${data.user}`;
|
||||
break;
|
||||
|
@ -19,6 +19,7 @@ class NotificationContainer extends Component {
|
||||
lastNotificationId: null,
|
||||
notificationLoading: false,
|
||||
readAllNotificationLoading: false,
|
||||
selectedFilter: 'activities',
|
||||
};
|
||||
}
|
||||
|
||||
@ -31,8 +32,10 @@ class NotificationContainer extends Component {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { selectedFilter } = this.state;
|
||||
|
||||
if (nextProps.activeBottomTab === ROUTES.TABBAR.NOTIFICATION && nextProps.username) {
|
||||
this._getAvtivities();
|
||||
this._getAvtivities(selectedFilter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +113,10 @@ class NotificationContainer extends Component {
|
||||
navigation.navigate(ROUTES.SCREENS.LOGIN);
|
||||
};
|
||||
|
||||
_changeSelectedFilter = (value) => {
|
||||
this.setState({ selectedFilter: value });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { isLoggedIn } = this.props;
|
||||
const {
|
||||
@ -130,6 +137,7 @@ class NotificationContainer extends Component {
|
||||
notificationLoading={notificationLoading}
|
||||
readAllNotificationLoading={readAllNotificationLoading}
|
||||
isLoggedIn={isLoggedIn}
|
||||
changeSelectedFilter={this._changeSelectedFilter}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ class NotificationScreen extends PureComponent {
|
||||
isLoggedIn,
|
||||
notificationLoading,
|
||||
readAllNotificationLoading,
|
||||
changeSelectedFilter,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -56,6 +57,7 @@ class NotificationScreen extends PureComponent {
|
||||
readAllNotification={readAllNotification}
|
||||
readAllNotificationLoading={readAllNotificationLoading}
|
||||
loading={notificationLoading}
|
||||
changeSelectedFilter={changeSelectedFilter}
|
||||
/>
|
||||
) : (
|
||||
<NoPost
|
||||
|
Loading…
Reference in New Issue
Block a user