[react-native]: add snap types to ScrollViewProps

This commit is contained in:
Flávio Caetano
2019-02-11 15:07:19 -02:00
parent 363cdf403a
commit 65b4249fbe
2 changed files with 41 additions and 15 deletions
+38 -15
View File
@@ -6297,21 +6297,6 @@ export interface ScrollViewPropsIOS {
*/
scrollsToTop?: boolean;
/**
* When snapToInterval is set, snapToAlignment will define the relationship of the the snapping to the scroll view.
* - start (the default) will align the snap at the left (horizontal) or top (vertical)
* - center will align the snap in the center
* - end will align the snap at the right (horizontal) or bottom (vertical)
*/
snapToAlignment?: "start" | "center" | "end";
/**
* When set, causes the scroll view to stop at multiples of the value of snapToInterval.
* This can be used for paginating through children that have lengths smaller than the scroll view.
* Used in combination with snapToAlignment.
*/
snapToInterval?: number;
/**
* An array of child indices determining which children get docked to the
* top of the screen when scrolling. For example passing
@@ -6484,6 +6469,44 @@ export interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollVi
* functionality for the ScrollView.
*/
refreshControl?: React.ReactElement<RefreshControlProps>;
/**
* When `snapToInterval` is set, `snapToAlignment` will define the relationship of the the snapping to the scroll view.
* - `start` (the default) will align the snap at the left (horizontal) or top (vertical)
* - `center` will align the snap in the center
* - `end` will align the snap at the right (horizontal) or bottom (vertical)
*/
snapToAlignment?: "start" | "center" | "end";
/**
* When set, causes the scroll view to stop at multiples of the value of `snapToInterval`.
* This can be used for paginating through children that have lengths smaller than the scroll view.
* Used in combination with `snapToAlignment` and `decelerationRate="fast"`. Overrides less
* configurable `pagingEnabled` prop.
*/
snapToInterval?: number;
/**
* When set, causes the scroll view to stop at the defined offsets. This can be used for
* paginating through variously sized children that have lengths smaller than the scroll view.
* Typically used in combination with `decelerationRate="fast"`. Overrides less configurable
* `pagingEnabled` and `snapToInterval` props.
*/
snapToOffsets?: number[];
/**
* Use in conjuction with `snapToOffsets`. By default, the beginning of the list counts as a
* snap offset. Set `snapToStart` to false to disable this behavior and allow the list to scroll
* freely between its start and the first `snapToOffsets` offset. The default value is true.
*/
snapToStart?: boolean;
/**
* Use in conjuction with `snapToOffsets`. By default, the end of the list counts as a snap
* offset. Set `snapToEnd` to false to disable this behavior and allow the list to scroll freely
* between its end and the last `snapToOffsets` offset. The default value is true.
*/
snapToEnd?: boolean;
}
declare class ScrollViewComponent extends React.Component<ScrollViewProps> {}
+3
View File
@@ -454,6 +454,9 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
nestedScrollEnabled={true}
invertStickyHeaders={true}
contentOffset={{ x: 0, y: 0 }}
snapToStart={false}
snapToEnd={false}
snapToOffsets={[100, 300, 500]}
{...props}
style={[scrollViewStyle1.scrollView, scrollViewStyle2]}
/>