react-bootstrap-typeahead
Version:
React typeahead with Bootstrap styling
13 lines (12 loc) • 392 B
JavaScript
import getOptionLabel from './getOptionLabel';
function getInputText(props) {
const { activeItem, labelKey, multiple, selected, text } = props;
if (activeItem) {
return getOptionLabel(activeItem, labelKey);
}
if (!multiple && selected.length && selected[0]) {
return getOptionLabel(selected[0], labelKey);
}
return text;
}
export default getInputText;