-
Notifications
You must be signed in to change notification settings - Fork 31
use useFirstPaint to control animation in Checkbox and Radio #2744
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
Conversation
useIsFirstRender rewritten and used in Checkbox and Radio
| isFirstRender.current = false; | ||
| return true; | ||
| } | ||
| React.useLayoutEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @clxandstuff , we need isomorphic version here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
i see that you're still using state to communicate about first render (inside first render hook). I think this may cause some unexpected side effects. Let's take a look into tests. |
|
Take a look now. I removed states related to animation from |
…inly/style-guide into DS-5347-radio-animation-is-not-fired
|
thx @clxandstuff , could you please add separate story documentation for is first render hook specifically |
…inly/style-guide into DS-5347-radio-animation-is-not-fired
|
hey @clxandstuff I see 2 problems with the example below:
|

I created a new hook
useFirstPaintto replaceuseIsFirstRender. It checks whether the component render function has triggered the first paint of DOM.It has been used in Checkbox and Radio to prevent animation on the initial render and to replace the
isPristineflag.