I have made a simple animation with a search bar using react-spring's useSpring()
. When in focus, I want the search bar to change width
, change its margin
to 0
, and change its top
value to 0
.
The first issue I encounter is that the margin does not change. I don't know if this is an issue with the auto keyword, but the search bar is centred before the animation, and doesn't change.
The second issue is that when I resize the window, the top
value and width
value of the search bar (which are in units of vw
and vh
) don't update until the page is refreshed, or the search bar goes back into focus.
I've linked my code here
Will I need to make the app auto-refresh
on window resize
to fix this?