We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Couldn't find a way to make the dropdown component closed on mobile and open on the desktop without transition.
It works as I expected on mobile, but due to update from useEffect, there's transition on desktop as it's set to open
const [isExpanded, setisExpanded] = useState<boolean>(false); const { getCollapseProps, getToggleProps } = useCollapse({ isExpanded, defaultExpanded: false, }); useEffect(() => { if (window.innerWidth > 700) { setisExpanded(true); } }, []);
With this code above, there's a transition on desktop when component mounts
The text was updated successfully, but these errors were encountered:
If you're not server-side rendering, you can skip the useEffect altogether:
useEffect
const [isExpanded, setisExpanded] = useState<boolean>(window.innerWidth > 700); const { getCollapseProps, getToggleProps } = useCollapse({isExpanded});
You're also not supposed to use defaultExpanded and isExpanded together, so you should leave out defaultExpanded.
defaultExpanded
isExpanded
You can also use the hasDisabledAnimation to enable/disable transitions at any point in the hook's lifecycle.
hasDisabledAnimation
Sorry, something went wrong.
Can you help with a sample code ?
No branches or pull requests
Couldn't find a way to make the dropdown component closed on mobile and open on the desktop without transition.
It works as I expected on mobile, but due to update from useEffect, there's transition on desktop as it's set to open
With this code above, there's a transition on desktop when component mounts
Screen.Recording.2023-01-28.at.08.04.24.mov
The text was updated successfully, but these errors were encountered: