We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b66c67c commit 6fa1e40Copy full SHA for 6fa1e40
1 file changed
packages/@primereact/core/src/motion/useMotion.ts
@@ -100,6 +100,15 @@ export const useMotion = withHeadless({
100
if (props.visible) {
101
if (shouldAppear || !isInitialMount.current) {
102
enter?.();
103
+ } else if (props.cssVarPrefix) {
104
+ // Initial mount with visible=true and no appear animation.
105
+ // createMotion sets CSS vars to 0px, so we need to override them to auto
106
+ // to ensure the content is visible immediately.
107
+ const widthVar = resolveCSSVarName(props.cssVarPrefix, 'width');
108
+ const heightVar = resolveCSSVarName(props.cssVarPrefix, 'height');
109
+
110
+ element.style.setProperty(widthVar, 'auto');
111
+ element.style.setProperty(heightVar, 'auto');
112
}
113
} else {
114
leave?.()?.then(() => {
0 commit comments