Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MultiDropdownList] Having the possibility to open/close #1241

Open
kud opened this issue Nov 18, 2019 · 6 comments
Assignees
Labels
Milestone

Comments

@kud
Copy link

@kud kud commented Nov 18, 2019

Affected Projects
React.js / Web

Is your feature request related to a problem? Please describe.
As a developer, I would like to be able to manage the fact the dropdown is displayed or not via for instance having isOpen as prop and not state.

Additional context
I would like to close the dropdown everytime the user clicks on an item in the dropdown.

@kud kud added the enhancement label Nov 18, 2019
@bietkul

This comment has been minimized.

Copy link
Collaborator

@bietkul bietkul commented Nov 18, 2019

Can you please tell in which component you're getting the issue?
Does render prop not work for your use-case?

@kud

This comment has been minimized.

Copy link
Author

@kud kud commented Nov 18, 2019

It's on MultiDropdownList. I don't see any way to open and close the dropdown by myself in fact.

I could use MultiDataList and rendering the whole thing by my self but it could be a shame because I want the dropdown like you did on MultiDropdownList

I just need to be able to open and close the dropdown via a prop in MultiDropdownList.

@kud

This comment has been minimized.

Copy link
Author

@kud kud commented Nov 18, 2019

var Dropdown = function (_Component) {
	_inherits(Dropdown, _Component);

	function Dropdown(props) {
		_classCallCheck(this, Dropdown);

		var _this = _possibleConstructorReturn(this, _Component.call(this, props));

		_this.toggle = function () {
			_this.setState({
				isOpen: !_this.state.isOpen
			});
		};

Here you've got a state, that means you can't handle it externally.

@bietkul

This comment has been minimized.

Copy link
Collaborator

@bietkul bietkul commented Nov 18, 2019

It can be handled with the render method but it doesn't make sense to render the complete UI for this minor functionality, I think the quick solution will be to provide access to the ref of Downshift component.

@bietkul bietkul added this to the 3.1.1 milestone Nov 18, 2019
@kud

This comment has been minimized.

Copy link
Author

@kud kud commented Nov 21, 2019

Can't I play with downshiftProps like something:

                  downshiftProps={{
                    isOpen: true,
                  }}

(this one doesn't work for the moment)

?

@kud

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.