[FIX] Room members filter (#655)
This commit is contained in:
parent
e9f57e0337
commit
b1236f2f21
|
@ -20,6 +20,7 @@ import log from '../../utils/log';
|
||||||
import { isAndroid } from '../../utils/deviceInfo';
|
import { isAndroid } from '../../utils/deviceInfo';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
import SearchBox from '../../containers/SearchBox';
|
import SearchBox from '../../containers/SearchBox';
|
||||||
|
import protectedFunction from '../../lib/methods/helpers/protectedFunction';
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
||||||
|
@ -118,6 +119,16 @@ export default class RoomMembersView extends LoggedView {
|
||||||
this.rooms.removeAllListeners();
|
this.rooms.removeAllListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSearchChangeText = protectedFunction((text) => {
|
||||||
|
const { members } = this.state;
|
||||||
|
let membersFiltered = [];
|
||||||
|
|
||||||
|
if (members && members.length > 0 && text) {
|
||||||
|
membersFiltered = members.filter(m => m.username.toLowerCase().match(text.toLowerCase()));
|
||||||
|
}
|
||||||
|
this.setState({ filtering: !!text, membersFiltered });
|
||||||
|
})
|
||||||
|
|
||||||
navigationButtonPressed = ({ buttonId }) => {
|
navigationButtonPressed = ({ buttonId }) => {
|
||||||
const { allUsers } = this.state;
|
const { allUsers } = this.state;
|
||||||
const { componentId } = this.props;
|
const { componentId } = this.props;
|
||||||
|
@ -141,16 +152,6 @@ export default class RoomMembersView extends LoggedView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchChangeText = (text) => {
|
|
||||||
const { members } = this.state;
|
|
||||||
|
|
||||||
let membersFiltered = [];
|
|
||||||
if (text) {
|
|
||||||
membersFiltered = members.filter(m => m.username.toLowerCase().match(text.toLowerCase()));
|
|
||||||
}
|
|
||||||
this.setState({ filtering: !!text, membersFiltered });
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressUser = async(item) => {
|
onPressUser = async(item) => {
|
||||||
try {
|
try {
|
||||||
const subscriptions = database.objects('subscriptions').filtered('name = $0', item.username);
|
const subscriptions = database.objects('subscriptions').filtered('name = $0', item.username);
|
||||||
|
|
Loading…
Reference in New Issue