Fix: Prevent scrollbars from flashing on resize

This commit is contained in:
Lance
2024-11-15 09:45:41 -08:00
parent af6c3f84c6
commit 41a4e206d8
2 changed files with 3 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ function RiveComponent({
const containerStyle = {
width: '100%',
height: '100%',
overflow: 'hidden',
...style,
};

View File

@@ -428,6 +428,7 @@ describe('useRive', () => {
<RiveTestComponent className="rive-test-clas" style={{ width: '50%' }} />
);
expect(container.firstChild).not.toHaveStyle('width: 50%');
expect(container.firstChild).not.toHaveStyle('overflow: hidden');
});
it('has a canvas size of 0 by default', async () => {
@@ -454,6 +455,7 @@ describe('useRive', () => {
const { RiveComponent: RiveTestComponent } = result.current;
const { container } = render(<RiveTestComponent />);
expect(container.querySelector('canvas')).toHaveStyle('width: 0');
expect(container.firstChild).toHaveStyle('overflow: hidden');
});
it('sets the canvas width and height after calculating the container size', async () => {