Viewability
Says how much of a List's row must be on screen before its visible signal turns true.
Usage
Scroll a list in a test.
This type is used by List
// Scroll a list in a test.
import { List, Text } from 'kuito';
import { assert, render, screen, scroll, test } from 'kuito/tests';
const rows = Array.from({ length: 200 }, (_, index) => `Row ${index}`);
const Long = () => <List data={rows} renderItem={({ item }) => <Text height={44}>{item}</Text>} />;
test('rows far down bind once the list scrolls to them', async () => {
await render(<Long />);
assert.equal(screen.queryByText('Row 150'), null);
await scroll(screen.getByText('Row 0'), { y: 150 * 44 });
assert.ok(screen.getByText('Row 150'));
});Type declaration
export interface Viewability {
/** The fraction of a row, 0 to 1, that must be on screen for it to count as visible; 0 by default. */
threshold?: number;
}Members 1
| Name | Type | Required | Description |
|---|---|---|---|
threshold | number | No | The fraction of a row, 0 to 1, that must be on screen for it to count as visible; 0 by default. |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.