Skip to content

setitem height, number of visible rows as defaults #2916

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

Merged
merged 5 commits into from
Jan 29, 2024

Conversation

adids1221
Copy link
Contributor

Description

WheelPicker driver set default values

Changelog

WheelPicker driver set default values

Additional info

const moveToItem = (index: number, numberOfRows: number, itemHeight: number) => {

const moveToItem = (index: number,
numberOfRows: number = NUMBER_OF_VISIBLE_ROWS,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the number of visible rows, this is the number of rows i.e. props.items.length

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it, WDYT about exporting the ITEMS_HEIGHT ?
do we need this small export ?
in the WheelPicker testing you have custom values

@adids1221 adids1221 requested a review from Inbal-Tish January 28, 2024 13:16

const itemsLength = listDriver.getProps().data?.length ?? 0;

const moveToItem = (index: number, itemHeight: number, numberOfRows: number = itemsLength) => {
Copy link
Collaborator

@Inbal-Tish Inbal-Tish Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the default ITEM_HEIGHT taken from the component? The whole point here was to add default values to itemHeight and numberOfRows...

});

it('should call onChange after scrolling ends with default itemHeight and numberOfRows', () => {
const itemHeight = 44;
Copy link
Collaborator

@Inbal-Tish Inbal-Tish Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be passed if we want to test the defaults, nighter numberOfRows

@adids1221 adids1221 requested a review from Inbal-Tish January 28, 2024 13:54
expect(onChange).toHaveBeenCalledWith(7, 7);
});

it('should call onChange after scrolling ends with default itemHeight and numberOfRows', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just move this test before the other one as we test the defaults first

@Inbal-Tish
Copy link
Collaborator

@adids1221 Approved with a small comment

@adids1221 adids1221 enabled auto-merge (squash) January 29, 2024 08:02
@adids1221 adids1221 merged commit 763f715 into master Jan 29, 2024
@adids1221 adids1221 deleted the infra/wheelPicker_test_drvier_defaults branch January 29, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants