mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-29 22:07:46 +03:00
Resolved conflict on notification container
This commit is contained in:
commit
97ca61fbca
@ -7,7 +7,6 @@ import { DropdownButton } from '../../dropdownButton';
|
||||
|
||||
// Components
|
||||
import { LineBreak } from '../../basicUIElements';
|
||||
import { PulseAnimation } from '../../animations';
|
||||
|
||||
// Styles
|
||||
import styles from './filterBarStyles';
|
||||
@ -28,7 +27,6 @@ const FilterBarView = ({
|
||||
rightIconName,
|
||||
rightIconType,
|
||||
selectedOptionIndex,
|
||||
rightIconLoading,
|
||||
}) => (
|
||||
<View style={styles.container}>
|
||||
{!isHide && (
|
||||
@ -41,7 +39,7 @@ const FilterBarView = ({
|
||||
onSelect={onDropdownSelect}
|
||||
selectedOptionIndex={selectedOptionIndex}
|
||||
/>
|
||||
{rightIconName && !rightIconLoading && (
|
||||
{rightIconName && (
|
||||
<TouchableOpacity
|
||||
onPress={() => onRightIconPress && onRightIconPress()}
|
||||
style={styles.rightIconWrapper}
|
||||
@ -54,18 +52,6 @@ const FilterBarView = ({
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
{rightIconName && rightIconLoading && (
|
||||
<View style={styles.rightIconWrapper}>
|
||||
<PulseAnimation
|
||||
color="#357ce6"
|
||||
numPulses={1}
|
||||
diameter={20}
|
||||
speed={100}
|
||||
duration={100}
|
||||
isShow={!rightIconLoading}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</LineBreak>
|
||||
)}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { PureComponent, Fragment } from 'react';
|
||||
import {
|
||||
View, ScrollView, FlatList, ActivityIndicator,
|
||||
View, ScrollView, FlatList, ActivityIndicator, RefreshControl,
|
||||
} from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
@ -142,20 +142,26 @@ class NotificationView extends PureComponent {
|
||||
return 4;
|
||||
};
|
||||
|
||||
_getActivityIndicator = () => (
|
||||
<View style={styles.loading}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
|
||||
render() {
|
||||
const {
|
||||
readAllNotification, getActivities, loading, readAllNotificationLoading,
|
||||
readAllNotification,
|
||||
getActivities,
|
||||
loading,
|
||||
readAllNotificationLoading,
|
||||
isDarkTheme,
|
||||
} = this.props;
|
||||
const { filters, selectedFilter } = this.state;
|
||||
|
||||
const _notifications = this._getNotificationsArrays();
|
||||
|
||||
if (_notifications.length === 0) {
|
||||
return (
|
||||
<View style={styles.loading}>
|
||||
<ActivityIndicator animating size="large" />
|
||||
</View>
|
||||
);
|
||||
return this._getActivityIndicator();
|
||||
}
|
||||
|
||||
return (
|
||||
@ -165,9 +171,9 @@ class NotificationView extends PureComponent {
|
||||
options={filters.map(item => item.value)}
|
||||
defaultText="ALL ACTIVITIES"
|
||||
onDropdownSelect={this._handleOnDropdownSelect}
|
||||
rightIconName="ios-checkmark"
|
||||
rightIconName="check"
|
||||
rightIconType="MaterialIcons"
|
||||
onRightIconPress={readAllNotification}
|
||||
rightIconLoading={readAllNotificationLoading}
|
||||
/>
|
||||
<ScrollView
|
||||
style={styles.scrollView}
|
||||
@ -175,9 +181,8 @@ class NotificationView extends PureComponent {
|
||||
let paddingToBottom = 1;
|
||||
paddingToBottom += e.nativeEvent.layoutMeasurement.height;
|
||||
if (
|
||||
e.nativeEvent.contentOffset.y
|
||||
>= e.nativeEvent.contentSize.height - paddingToBottom
|
||||
&& !loading
|
||||
e.nativeEvent.contentOffset.y >= e.nativeEvent.contentSize.height - paddingToBottom
|
||||
&& !loading
|
||||
) {
|
||||
getActivities(selectedFilter, true);
|
||||
}
|
||||
@ -185,6 +190,17 @@ class NotificationView extends PureComponent {
|
||||
>
|
||||
<FlatList
|
||||
data={_notifications}
|
||||
refreshing={readAllNotificationLoading}
|
||||
onRefresh={() => null}
|
||||
refreshControl={(
|
||||
<RefreshControl
|
||||
refreshing={readAllNotificationLoading}
|
||||
progressBackgroundColor="#357CE6"
|
||||
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
|
||||
titleColor="#fff"
|
||||
colors={['#fff']}
|
||||
/>
|
||||
)}
|
||||
renderItem={({ item, index }) => (
|
||||
<Fragment>
|
||||
<ContainerHeader
|
||||
|
@ -22,6 +22,14 @@ class NotificationContainer extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { username } = this.props;
|
||||
|
||||
if (username) {
|
||||
this._getAvtivities();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.activeBottomTab === ROUTES.TABBAR.NOTIFICATION) {
|
||||
if (nextProps.username) {
|
||||
@ -98,12 +106,15 @@ class NotificationContainer extends Component {
|
||||
|
||||
render() {
|
||||
const { isLoggedIn } = this.props;
|
||||
const { notifications, notificationLoading, readAllNotificationLoading } = this.state;
|
||||
const {
|
||||
notifications, notificationLoading, readAllNotificationLoading, isDarkTheme,
|
||||
} = this.state;
|
||||
|
||||
return (
|
||||
<NotificationScreen
|
||||
getActivities={this._getAvtivities}
|
||||
notifications={notifications}
|
||||
isDarkTheme={isDarkTheme}
|
||||
navigateToNotificationRoute={this._navigateToNotificationRoute}
|
||||
readAllNotification={this._readAllNotification}
|
||||
handleLoginPress={this._handleOnPressLogin}
|
||||
@ -116,8 +127,10 @@ class NotificationContainer extends Component {
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
username: state.account.currentAccount.name,
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
isDarkTheme: state.application.isDarkTheme,
|
||||
|
||||
username: state.account.currentAccount.name,
|
||||
activeBottomTab: state.ui.activeBottomTab,
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user