From 4edf0003cffeddf8664c7cde6b7711682e19f8d0 Mon Sep 17 00:00:00 2001 From: John Gozde Date: Fri, 12 Apr 2019 17:46:02 -0600 Subject: [PATCH] react-window: add "smart" align option (1.8) --- types/react-window/index.d.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/types/react-window/index.d.ts b/types/react-window/index.d.ts index a9c36fa0d0..571c8119df 100644 --- a/types/react-window/index.d.ts +++ b/types/react-window/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-window 1.7 +// Type definitions for react-window 1.8 // Project: https://github.com/bvaughn/react-window/, http://react-window.now.sh // Definitions by: Martynas KadiĊĦa // Alex Guerra @@ -20,7 +20,7 @@ export type CSSDirection = "ltr" | "rtl"; export type Direction = "vertical" | "horizontal"; // TODO: deprecate in favour of Layout export type Layout = "vertical" | "horizontal"; export type ScrollDirection = "forward" | "backward"; -export type Align = "auto" | "center" | "end" | "start"; +export type Align = "auto" | "smart" | "center" | "end" | "start"; export interface ListChildComponentProps { index: number; @@ -372,6 +372,10 @@ export class FixedSizeList extends Component { * You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are: * * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) + * - smart + * - If the item is already visible, don't scroll at all. + * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. + * - If it is more than one viewport away, scroll so that it is centered within the list. * - center - Center align the item within the list. * - end - Align the item to the end of the list (the bottom for vertical lists or the right for horizontal lists). * - start - Align the item to the beginning of the list (the top for vertical lists or the left for horizontal lists). @@ -391,6 +395,10 @@ export class VariableSizeList extends Component { * You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are: * * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) + * - smart + * - If the item is already visible, don't scroll at all. + * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. + * - If it is more than one viewport away, scroll so that it is centered within the list. * - center - Center align the item within the list. * - end - Align the item to the end of the list (the bottom for vertical lists or the right for horizontal lists). * - start - Align the item to the beginning of the list (the top for vertical lists or the left for horizontal lists). @@ -420,6 +428,10 @@ export class FixedSizeGrid extends Component { * You can control the alignment of the item though by specifying an `align` property. Acceptable values are: * * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) + * - smart + * - If the item is already visible, don't scroll at all. + * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. + * - If it is more than one viewport away, scroll so that it is centered within the grid. * - center - Center align the item within the grid. * - end - Align the item to the bottom, right hand side of the grid. * - start - Align the item to the top, left hand of the grid. @@ -445,6 +457,10 @@ export class VariableSizeGrid extends Component { * You can control the alignment of the item though by specifying an `align` property. Acceptable values are: * * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) + * - smart + * - If the item is already visible, don't scroll at all. + * - If it is less than one viewport away, scroll as little as possible so that it becomes visible. + * - If it is more than one viewport away, scroll so that it is centered within the grid. * - center - Center align the item within the grid. * - end - Align the item to the bottom, right hand side of the grid. * - start - Align the item to the top, left hand of the grid.