type UIScrollView.ScrollEventData
The data structure contained by each UIScrollView.ScrollEvent.
type ScrollEventData = {
yOffset: number;
xOffset: number;
horizontalVelocity: number;
verticalVelocity: number;
scrolledDown?: boolean;
scrolledUp?: boolean;
scrolledHorizontalStart?: boolean;
scrolledHorizontalEnd?: boolean;
atTop?: boolean;
atBottom?: boolean;
atHorizontalStart?: boolean;
atHorizontalEnd?: boolean;
};Notes
- The platform dependent offsets
xOffsetandyOffsetcan be saved and restored later using UIScrollView.scrollTo(). These should not be used for any other purpose. - The
horizontalVelocityandverticalVelocity(a number representing the approximate screen widths/heights per second), andscrolledUp,scrolledDown,scrolledHorizontalStart,scrolledHorizontalEnd(booleans) values are platform independent and represent the last scroll movement. - The boolean values of
atTop,atBottom,atHorizontalStart, andatHorizontalEndrepresent the current position. These are affected by the threshold values set on the UIScrollView instance itself — e.g. with a top threshold of 5 pixels, theatTopvalue remains true while the container is scrolled within 0-5 pixels from the top of its content.
Instance members
yOffset
Vertical scroll offset; platform-dependent value, should not be used for positioning but can be used withUIScrollContainer.scrollTo().xOffset
Horizontal scroll offset; platform-dependent value, may change with text direction, should not be used for positioning but can be used withUIScrollContainer.scrollTo().horizontalVelocity
Horizontal scrolling velocity (screen widths per second).verticalVelocity
Horizontal scrolling velocity (screen heights per second).scrolledDown
True if (last) scrolled down.scrolledUp
True if (last) scrolled up.scrolledHorizontalStart
True if (last) scrolled left for LTR text direction, right for RTL.scrolledHorizontalEnd
True if (last) scrolled right for LTR text direction, left for RTL.atTop
True if the scroll container is scrolled to the top.atBottom
True if the scroll container is scrolled to the bottom.atHorizontalStart
True if the scroll container is scrolled to the left for LTR text direction, right for RTL.atHorizontalEnd
True if the scroll container is scrolled to the right for LTR text direction, left for RTL.
Related
class UIScrollView
A view class that represents a container element that allows users to scroll, emitting asynchronous scroll events.
