Repository navigation
Conversation
setData(next) and scrollToIndex in one handler send the command before the data. On Android the waiting jump kept slots for the old keys, which never render, so it sat on the new top rows until its 1 s deadline. With a list shorter than the index, both platforms clamped to the old last row and stayed there (rows 94-99 on Android, 495-499 on iOS, for index 200). A data change now aims the waiting jump at its index in the new rows and keeps its deadline, and an index past the data waits for the data to grow.
Each scroll command now carries an id, and Android sends onScrollCommandEnd with it once the list rests: after the layout pass and realign of an instant scroll, at the idle state after a glide, and at once when nothing moves. A drag, leaving the window and anchoring's own scroll end the command early. New data sends a command still on its way to its target in the new rows, where anchoring used to put back the old top row and the list ended at its last row.
Each scroll command now sends onScrollCommandEnd with its id on iOS once the list rests: right after an instant scroll, at the end of a glide or a realign, and at once when nothing moves. A drag, the status bar, anchoring's own scroll and leaving the window end the command early. UIKit ends a glide that a newer scroll interrupts from inside that newer call, so only the end of the command's own glide lands it.
An animated scroll sent while another glide ran never reported its end and jumped to its target instead of gliding. UIKit ends the replaced glide from inside the new setContentOffset call, and that callback re-landed on the new target, which stopped the new glide. The callback now ignores the glide being replaced, so the new one carries on and its own end lands the command.
scrollToIndex, scrollToOffset and scrollToEnd now return a Promise that resolves once the list rests after the scroll, or when a drag, a newer scroll or an unmount ends it first. A scroll sent in the same frame as new data is sent again after that data reaches native, under a new id the Promise follows, so setData and scrollToIndex from one handler land on the new rows. On iOS the first one could stop 1.5 rows past the index. The out-of-range warning now checks the index against the data at the end of that frame.
A scroll command sent while a finger held the list, from a timer or an onScroll handler, landed under the finger and waited for the list to rest. After a release without momentum no layout runs, so nothing ended it, and its Promise stayed pending until the next command (24 s in one run). The end of a drag without momentum now ends it.
scrollToItem, scrollToTop, scrollIndexIntoView and scrollItemIntoView return a Promise like the other scroll methods, and setNativeProps reaches the list's native view. The into-view methods scroll only when the row is not fully visible, to the edge it is past, as LegendList does. The list also takes the four keyboard event props, progressViewOffset and alignItemsAtEnd.
Reanimated's scrollTo and code written against a ScrollView ref now reach the list. The native scrollTo and flashScrollIndicators commands take ScrollView's names and arguments, and scrollTo ends the scroll in flight and moves along the list's axis from the content start. getScrollResponder returns a ScrollView-shaped object, which scrollViewRef and refScrollView also receive, and getNativeScrollRef returns the host view.
A ref typed for FlatList, FlashList or LegendList failed to type-check against Flume's ref prop, since the prop asked for every member of Flume's handle. The prop now takes the members the three lists share, and the item type still comes from data. FlumeRef takes the item type, and ComponentRef<typeof Flume> reads the handle with its Promises.
The status bar tap now reports onScrollToTop with the scroll event, both when UIKit scrolls the list and when a list that can show React rows scrolls through its own jump, whose glide UIKit never reports. scrollsToTop takes the tap away from a list and stays off by default for a horizontal one. Android accepts the prop and ignores it, as React Native does.
The list never showed a scroll bar on Android, so showsVerticalScrollIndicator and flashScrollIndicators had nothing to show. A RecyclerView built in code gets no scroll bar drawable, since only a style with android:scrollbars creates one. The list now takes ScrollView's default style, as React Native's ScrollView does, and draws its bars outside the padding.
FlatList takes alwaysBounceHorizontal, indicatorStyle, directionalLockEnabled, canCancelContentTouches, scrollToOverflowEnabled and automaticallyAdjustsScrollIndicatorInsets on iOS and persistentScrollbar on Android, and Flume dropped them. Each now reaches the native list, and the other platform accepts it and ignores it, as React Native does.
The Chat and React tabs show the last scroll command, how long its Promise took to settle and how many are still open. The React tab gets an Into view 40 button.
A reset while an animated scroll ran its last stretch resolved the scroll's Promise at once, then sent the scroll again with no id, so code after the await ran before the list arrived. The list stopped the old glide before taking the command up again, and that stop looked like the scroll's rest. The command now restarts before the glide stops and ends at the real rest.
|
Caution Review failedThe pull request is closed. Walkthrough
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the scroll methods on the ref returned nothing, so an app had no way to wait for a scroll before it highlights or focuses a row.
scrollToIndex,scrollToOffsetandscrollToEndnow return a Promise that resolves when the list comes to rest, or when a drag, a newer scroll or an unmount stops it first. it never rejects. a scroll sent in the same frame as new data keeps its Promise and lands on the new rows.the ref also gets the rest of what FlatList, FlashList and LegendList refs have:
scrollToItem,scrollToTop,scrollIndexIntoView,scrollItemIntoView,setNativeProps,flashScrollIndicators,getScrollResponderandgetNativeScrollRef. a ref typed asFlatList<Item>,FlashListRef<Item>orLegendListReffits therefprop,FlumeRef<Item>types the Promises, and Reanimated'sscrollToscrolls the list. new props:scrollViewRefandrefScrollView, the four keyboard events,progressViewOffset,alignItemsAtEnd,persistentScrollbaron Android, and on iOSscrollsToTop,onScrollToTop,alwaysBounceHorizontal,indicatorStyle,directionalLockEnabled,canCancelContentTouches,scrollToOverflowEnabledandautomaticallyAdjustsScrollIndicatorInsets.Android never drew a scroll bar, so
showsVerticalScrollIndicatorandflashScrollIndicatorsdid nothing there. the RecyclerView is built in code and never got a scroll bar drawable. it now takes ScrollView's default style, as React Native's ScrollView does, so Android lists show their scroll bars like a FlatList.Summary by CodeRabbit
New Features
Bug Fixes