Skip to content
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

fix(PullToRefresh): Stretch PullToRefresh horizontally #6613

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,27 @@ export const PullToRefreshPlayground = (
</ComponentPlayground>
);
};

export const PullToRefreshChildrenPositionPlayground = (props: ComponentPlaygroundProps) => {
return (
<ComponentPlayground {...props} platform="vkcom">
{({ ...props }: PullToRefreshProps) => (
<Div style={{ width: '300px', height: '500px', display: 'flex' }}>
<PullToRefresh {...props}>
<div
style={{
display: 'flex',
flexDirection: 'column',
textAlign: 'center',
justifyContent: 'center',
flex: '1 0',
}}
>
Smaller content can be centered vertically
</div>
</PullToRefresh>
</Div>
)}
</ComponentPlayground>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as React from 'react';
import { test } from '@vkui-e2e/test';
import { PullToRefreshPlayground } from './PullToRefresh.e2e-playground';
import {
PullToRefreshChildrenPositionPlayground,
PullToRefreshPlayground,
} from './PullToRefresh.e2e-playground';

test.describe('PullToRefresh', () => {
// we are interested in VKCOM only as we need to test here mostly
Expand Down Expand Up @@ -42,4 +45,18 @@ test.describe('PullToRefresh', () => {

await expectScreenshotClippedToContent();
});

test('takes whole parent height and allow smaller content to center vertically', async ({
page,
mount,
expectScreenshotClippedToContent,
componentPlaygroundProps,
}) => {
const result = await mount(
<PullToRefreshChildrenPositionPlayground {...componentPlaygroundProps} />,
);
await result.waitFor();
await page.evaluate(() => new Promise((resolve) => setTimeout(resolve, 500)));
await expectScreenshotClippedToContent();
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.PullToRefresh {
display: flex;
flex-direction: column;
flex-grow: 1;
}

Expand Down Expand Up @@ -67,6 +69,9 @@
}

.PullToRefresh__content {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow: hidden;
transition: transform 400ms var(--vkui--animation_easing_platform);
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading