mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-21 04:11:50 +03:00
Fixed voters filter and search issue
This commit is contained in:
parent
ee43ac7b4e
commit
377d6f23be
@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
|
||||
// Constants
|
||||
@ -13,12 +13,7 @@ import VotersDisplayView from '../view/votersDisplayView';
|
||||
*
|
||||
*/
|
||||
|
||||
class VotersDisplayContainer extends PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
class VotersDisplayContainer extends Component {
|
||||
_handleOnUserPress = username => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import { View, FlatList, Text } from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
@ -8,10 +8,9 @@ import { getTimeFromNow } from '../../../utils/time';
|
||||
// Components
|
||||
import { UserListItem } from '../../basicUIElements';
|
||||
// Styles
|
||||
// eslint-disable-next-line
|
||||
import styles from './votersDisplayStyles';
|
||||
|
||||
class VotersDisplayView extends PureComponent {
|
||||
class VotersDisplayView extends Component {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { PureComponent } from 'react';
|
||||
import { Component } from 'react';
|
||||
|
||||
import { isBefore } from '../utils/time';
|
||||
|
||||
import ROUTES from '../constants/routeNames';
|
||||
|
||||
class AccountListContainer extends PureComponent {
|
||||
class AccountListContainer extends Component {
|
||||
/* Props
|
||||
* ------------------------------------------------
|
||||
* @prop { type } name - Description....
|
||||
@ -15,6 +15,7 @@ class AccountListContainer extends PureComponent {
|
||||
this.state = {
|
||||
data: props.data,
|
||||
filterResult: null,
|
||||
filterIndex: '0',
|
||||
};
|
||||
}
|
||||
|
||||
@ -23,7 +24,7 @@ class AccountListContainer extends PureComponent {
|
||||
// Component Functions
|
||||
|
||||
_handleSearch = (searchText, key) => {
|
||||
const { data } = this.state;
|
||||
const { data, filterIndex } = this.state;
|
||||
|
||||
const newData = data.filter(item => {
|
||||
const itemName = item[key].toUpperCase();
|
||||
@ -32,12 +33,16 @@ class AccountListContainer extends PureComponent {
|
||||
return itemName.indexOf(_text) > -1;
|
||||
});
|
||||
|
||||
this.setState({ filterResult: newData });
|
||||
if (filterIndex !== '0') {
|
||||
this._handleOnVotersDropdownSelect(filterIndex, '', newData);
|
||||
} else {
|
||||
this.setState({ filterResult: newData });
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnVotersDropdownSelect = index => {
|
||||
_handleOnVotersDropdownSelect = (index, text, oldData) => {
|
||||
const { data } = this.state;
|
||||
const _data = data;
|
||||
const _data = Object.assign([], oldData || data);
|
||||
|
||||
switch (index) {
|
||||
case '0':
|
||||
@ -53,7 +58,7 @@ class AccountListContainer extends PureComponent {
|
||||
break;
|
||||
}
|
||||
|
||||
this.setState({ filterResult: _data });
|
||||
this.setState({ filterResult: _data, filterIndex: index });
|
||||
};
|
||||
|
||||
_handleOnUserPress = username => {
|
||||
|
Loading…
Reference in New Issue
Block a user