React-select: fade in/out animation for react-select in React hook/Css

Created on 1 Sep 2020  路  4Comments  路  Source: JedWatson/react-select

Please Help....
Appreciate for any answer !!!!

Here is my code
https://codesandbox.io/s/controller-with-react-select-qz78k?file=/src/index.js

Most helpful comment

All 4 comments

Greetings @szelam ,

Menu would be a welcome addition to the animated components, but there is a fair bit of complexity involved.

Here's a list to get you started and I could probably assist more as you make more progress on your codesandbox, as it would be a welcome addition to anyone looking to achieve the same as you are creating.

1) For starters, you could certainly need to use a custom component for Menu to handle the transitions.

2) The menu rendering is still dependent on menuIsOpen, which means that this state will need to be controlled, so the menuIsOpen prop will need to be passed into the Select component and managed in state outside the Select component. It looks like you are already doing this via open and setOpen

3) An onMenuOpen prop will need to be provided to the Select. It will need to do the following:

  • setOpen(true), which will in turn begin the open CSS transition you created in step 1
  • add a window event handler to capture any clicks which will trigger the exit CSS transition, and onTransitionEnd, then setOpen(undefined) as false would prevent the Menu from opening again.

4) Additionally, an onBlur prop would likely need to be added so that when the user tabs out from the input, the Menu closes.

5) An onChange event handler would need to be implemented to know if it should close the menu by checking against the closeMenuOnSelect.

Good luck if you choose to take this on and happy to help along the way.

Thank you for answering my question
I have update my code here
https://codesandbox.io/s/controller-with-react-select-qz78k?file=/src/index.js

when i use open to controlle menu list height ,it doesn't work .

Excellent work @szelam

Great job and thank you for sharing!

Was this page helpful?
0 / 5 - 0 ratings