fmoo/react-typeahead

Tokenizer results are always on top

eeiswerth opened this issue · 0 comments

The way in which I laid out my page required that I had tokenizer results on the bottom of the input, rather than the top. The tokenizer doesn't support this natively, but you can use a trick like this to get around it and force the results to the bottom. It's not pretty, but it gets the job done.

<Tokenizer
    ref={(t) => {
        if (t) {
            var n = ReactDOM.findDOMNode(t);
            var selections = $(n).find('.typeahead-token');
            if (selections.length === 0) {
                // No selections. Nothing to do.
                return;
            }
            var tokens = $(n).find('.typeahead-token').detach();
            var input = $(n).find('.typeahead');
            tokens.insertAfter(input);
        }
    }}
/>