-
public class ReactScrollViewHelperHelper class that deals with emitting Scroll Events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceReactScrollViewHelper.ScrollListenerpublic classReactScrollViewHelper.ReactScrollViewScrollStatepublic interfaceReactScrollViewHelper.HasScrollStatepublic interfaceReactScrollViewHelper.HasFlingAnimatorpublic interfaceReactScrollViewHelper.HasScrollEventThrottle
-
Field Summary
Fields Modifier and Type Field Description public final static longMOMENTUM_DELAYpublic final static StringOVER_SCROLL_ALWAYSpublic final static StringAUTOpublic final static StringOVER_SCROLL_NEVERpublic final static intSNAP_ALIGNMENT_DISABLEDpublic final static intSNAP_ALIGNMENT_STARTpublic final static intSNAP_ALIGNMENT_CENTERpublic final static intSNAP_ALIGNMENT_END
-
Method Summary
-
-
Method Detail
-
emitScrollEvent
static <T extends ViewGroup, ReactScrollViewHelper.HasScrollEventThrottle> void emitScrollEvent(T scrollView, float xVelocity, float yVelocity)
Shared by ReactScrollView and ReactHorizontalScrollView.
-
emitScrollBeginDragEvent
static <T extends ViewGroup, ReactScrollViewHelper.HasScrollEventThrottle> void emitScrollBeginDragEvent(T scrollView)
-
emitScrollEndDragEvent
static <T extends ViewGroup, ReactScrollViewHelper.HasScrollEventThrottle> void emitScrollEndDragEvent(T scrollView, float xVelocity, float yVelocity)
-
emitScrollMomentumBeginEvent
static <T extends ViewGroup, ReactScrollViewHelper.HasScrollEventThrottle> void emitScrollMomentumBeginEvent(T scrollView, int xVelocity, int yVelocity)
-
emitScrollMomentumEndEvent
static <T extends ViewGroup, ReactScrollViewHelper.HasScrollEventThrottle> void emitScrollMomentumEndEvent(T scrollView)
-
emitLayoutEvent
static void emitLayoutEvent(ViewGroup scrollView)
This is only for Java listeners. onLayout events emitted to JS are handled elsewhere.
-
parseOverScrollMode
static int parseOverScrollMode(String jsOverScrollMode)
-
parseSnapToAlignment
static int parseSnapToAlignment(@Nullable() String alignment)
-
getDefaultScrollAnimationDuration
static int getDefaultScrollAnimationDuration(Context context)
-
addScrollListener
static void addScrollListener(ReactScrollViewHelper.ScrollListener listener)
Adds a scroll listener.
Note that you must keep a reference to this scroll listener because this class only keeps aweak reference to it (to prevent memory leaks). This means that code like
addScrollListener(new ScrollListener() {...})won't work, you need to do this instead:mScrollListener = new ScrollListener() {...};ReactScrollViewHelper.addScrollListener(mScrollListener);instead.
-
removeScrollListener
static void removeScrollListener(ReactScrollViewHelper.ScrollListener listener)
-
smoothScrollTo
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> void smoothScrollTo(T scrollView, int x, int y)
Scroll the given view to the location (x, y), with provided initial velocity. This method worksby calculate the "would be" initial velocity with internal friction to move to the point (x,y), then apply that to the animator.
-
getNextFlingStartValue
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> int getNextFlingStartValue(T scrollView, int currentValue, int postAnimationValue, int velocity)
Get current position or position after current animation finishes, if any.
-
updateFabricScrollState
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> boolean updateFabricScrollState(T scrollView)
-
updateFabricScrollState
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> boolean updateFabricScrollState(T scrollView, int scrollX, int scrollY)
Called on any stabilized onScroll change to propagate content offset value to a Shadow Node.
-
forceUpdateState
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> void forceUpdateState(T scrollView)
-
updateStateOnScrollChanged
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator, ReactScrollViewHelper.HasScrollEventThrottle> void updateStateOnScrollChanged(T scrollView, float xVelocity, float yVelocity)
-
registerFlingAnimator
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> void registerFlingAnimator(T scrollView)
-
predictFinalScrollPosition
static <T extends ViewGroup, FabricViewStateManager.HasFabricViewStateManager, ReactScrollViewHelper.HasScrollState, ReactScrollViewHelper.HasFlingAnimator> Point predictFinalScrollPosition(T scrollView, int velocityX, int velocityY, int maximumOffsetX, int maximumOffsetY)
-
-
-
-