facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.22k stars 303 forks source link

gridTemplateRows 0fr is being compiled to 0px, which breaks css transition #498

Closed denexapp closed 2 months ago

denexapp commented 3 months ago

Describe the issue

Hey 👋

If I use gridTemplateRows with the value of 0fr, this value gets replaced with 0px.

There's a popular css trick, in order to smoothly open an accordeon, you may use a css transition from gridTemplateRows: 0fr to 1fr. This css transition breaks if 0fr is being compiled to 0px, as px can not be transitioned to fr (i think?).

Expected behavior

0fr shouldn't get compiled to 0px, and should be preserved. Basically, every transitionable property should be opted out from this optimization.

Steps to reproduce

  1. Create an example that uses the gridTemplateRows css transition trick from 0fr to 1fr, you may use the mentioned article as an example
  2. Make sure if it works with transitioning from repeat(1, 0fr) to repeat(1, 1fr)
  3. Replace repeat(1, 0fr) to 0fr and repeat(1, 1fr) to 1fr
  4. Transition will break

Test case

No response

Additional comments

My current workaround is to use repeat(1, 0fr) instead of 0fr and repeat(1, 1fr) insead of 1fr

denexapp commented 3 months ago

Feels related to https://github.com/facebook/stylex/issues/478

nmn commented 3 months ago

Yes, this is the same problem as #478. I'm on it.

tounsoo commented 2 months ago

@nmn Are you already making a fix for this or am I able to try my first contribution on this? 😄

Update: Made a PR for the fix, if the fix is already made on your end, feel free to close the PR 🙏

denexapp commented 2 months ago

@tounsoo real gigachad