Skip to content

Commit 3785ea6

Browse files
authored
Merge pull request #208 from jerboa88/206-fix-layout-shift-of-particles-background-on-mobile
Disable tsParticles fullscreen mode to fix background layout shift bug
2 parents 82de0cc + 0da7aa5 commit 3785ea6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/layout/particles-background.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ function UnmemoizedParticlesBackground() {
2424
const [init, setInit] = useState(false);
2525

2626
const classNameProps = getClassNameProps(
27-
'fixed h-lvh w-lvh mix-blend-overlay transition-opacity ease-out duration-[2s]',
27+
'fixed h-lvh w-lvw mix-blend-overlay transition-opacity ease-out duration-[2s]',
2828
init ? 'opacity-100' : 'opacity-0', // Hide until loaded
2929
);
30-
const tsParticlesConfig: RecursivePartial<IOptions> = {
30+
const tsParticlesOptions: RecursivePartial<IOptions> = {
3131
fpsLimit: 30,
3232
smooth: false,
3333
pauseOnBlur: true,
3434
pauseOnOutsideViewport: true,
3535
detectRetina: true,
36+
fullScreen: {
37+
enable: false,
38+
},
3639
particles: {
3740
color: {
3841
value: THEME.neutral,
@@ -84,7 +87,7 @@ function UnmemoizedParticlesBackground() {
8487
});
8588
}, []);
8689

87-
return <Particles options={tsParticlesConfig} {...classNameProps} />;
90+
return <Particles options={tsParticlesOptions} {...classNameProps} />;
8891
}
8992

9093
// Never re-render this component

0 commit comments

Comments
 (0)