mattermost-mobile/app/components/autocomplete_selector/index.ts
Daniel Espino García 76284a78d5
MM-34194 Add multiselect to Apps Forms (#5400)
* Add multiselect to Apps Forms

* Address feedback

* Add selected information and change button name

* Fix styles

* Add missing semicolon and change currentList to currentSelected.

* Address UX feedback

* Fix test

* Address feedback

* Fix snapshots

* Potential fix for flaky test

* Fix iOS back button

* Address feedback

* Fix tests

* Add separator and scroll to bottom on selected items

* Use setTimeout for scroll and also scroll on unselected

* Fix lint

* Fix tsc

* Fix tests
2021-10-27 11:35:11 +02:00

33 lines
1.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {ActionCreatorsMapObject, bindActionCreators, Dispatch} from 'redux';
import {setAutocompleteSelector} from '@actions/views/post';
import {getTeammateNameDisplaySetting, getTheme} from '@mm-redux/selectors/entities/preferences';
import AutocompleteSelector from './autocomplete_selector';
import type {Action, ActionResult, GenericAction} from '@mm-redux/types/actions';
import type {GlobalState} from '@mm-redux/types/store';
function mapStateToProps(state: GlobalState) {
return {
teammateNameDisplay: getTeammateNameDisplaySetting(state),
theme: getTheme(state),
};
}
type Actions = {
setAutocompleteSelector: (dataSource: any, onSelect: any, options: any, getDynamicOptions: any) => Promise<ActionResult>;
}
function mapDispatchToProps(dispatch: Dispatch<GenericAction>) {
return {
actions: bindActionCreators<ActionCreatorsMapObject<Action>, Actions>({
setAutocompleteSelector,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(AutocompleteSelector);