Skip to content

Commit

Permalink
Make autocomplete suggestions scrollable.
Browse files Browse the repository at this point in the history
This enable user to get all the options which matches
input and is more convenient as now we don't have to type much.

fix:#623
  • Loading branch information
jainkuniya authored and borisyankov committed Jun 3, 2017
1 parent 8bfb9fd commit ce0395c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/autocomplete/EmojiAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class EmojiAutocomplete extends Component {

render() {
const { filter, onAutocomplete } = this.props;
const emojis = getFilteredEmojiList(filter).slice(0, 5);
const emojis = getFilteredEmojiList(filter);

if (emojis.length === 0) return null;

Expand Down
5 changes: 1 addition & 4 deletions src/autocomplete/PeopleAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';


import { getAuth } from '../account/accountSelectors';
import { Popup } from '../common';
import UserItem from '../users/UserItem';
import { sortUserList, filterUsersStartingWith } from '../users/usersSelectors';


class PeopleAutocomplete extends Component {

props: {
Expand All @@ -20,8 +18,7 @@ class PeopleAutocomplete extends Component {

render() {
const { filter, ownEmail, users, onAutocomplete } = this.props;
const people = sortUserList(filterUsersStartingWith(users, filter, ownEmail))
.slice(1, 5);
const people = sortUserList(filterUsersStartingWith(users, filter, ownEmail));

if (people.length === 0) return null;

Expand Down
3 changes: 1 addition & 2 deletions src/autocomplete/StreamAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class StreamAutocomplete extends Component {
render() {
const { filter, subscriptions, onAutocomplete } = this.props;
const streams = subscriptions
.filter(x => x.name.toLowerCase().startsWith(filter.toLowerCase()))
.slice(0, 5);
.filter(x => x.name.toLowerCase().startsWith(filter.toLowerCase()));

if (streams.length === 0) return null;

Expand Down
9 changes: 6 additions & 3 deletions src/common/Popup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */
import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import { ScrollView, StyleSheet } from 'react-native';

import { BORDER_COLOR } from '../styles';

Expand All @@ -16,9 +16,12 @@ const styles = StyleSheet.create({
export default class Popup extends Component {
render() {
return (
<View style={styles.container}>
<ScrollView
style={styles.container}
maxHeight={300}
>
{this.props.children}
</View>
</ScrollView>
);
}
}

0 comments on commit ce0395c

Please sign in to comment.