Skip to content

Commit

Permalink
Revise documentation for scrollEventThrottle (#3971)
Browse files Browse the repository at this point in the history
* Revise documentation for scrollEventThrottle

* le

* Remove the iOS only flag for older versions
  • Loading branch information
NickGerleman authored Jan 5, 2024
1 parent 1cd6d5c commit 0ac8182
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion docs/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ The native driver also works with `Animated.event`. This is especially useful fo

```tsx
<Animated.ScrollView // <-- Use the Animated ScrollView wrapper
scrollEventThrottle={1} // <-- Use 1 here to make sure no events are ever missed
onScroll={Animated.event(
[
{
Expand Down
6 changes: 3 additions & 3 deletions docs/scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Called when the momentum scroll ends (scroll which occurs as the ScrollView glid

### `onScroll`

Fires at most once per frame during scrolling. The frequency of the events can be controlled using the `scrollEventThrottle` prop. The event has the following shape (all values are numbers):
Fires at most once per frame during scrolling. The event has the following shape (all values are numbers):

```js
{
Expand Down Expand Up @@ -575,9 +575,9 @@ Note that the view can always be scrolled by calling `scrollTo`.

---

### `scrollEventThrottle` <div class="label ios">iOS</div>
### `scrollEventThrottle`

This controls how often the scroll event will be fired while scrolling (as a time interval in ms). A lower number yields better accuracy for code that is tracking the scroll position, but can lead to scroll performance problems due to the volume of information being sent over the bridge. You will not notice a difference between values set between 1-16 as the JS run loop is synced to the screen refresh rate. If you do not need precise scroll position tracking, set this value higher to limit the information being sent across the bridge. The default value is `0`, which results in the scroll event being sent only once each time the view is scrolled.
Limits how often scroll events will be fired while scrolling, specified as a time interval in ms. This may be useful when expensive work is performed in response to scrolling. Values &le; `16` will disable throttling, regardless of the refresh rate of the device.

| Type | Default |
| ------ | ------- |
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.70/scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ Note that the view can always be scrolled by calling `scrollTo`.

---

### `scrollEventThrottle` <div class="label ios">iOS</div>
### `scrollEventThrottle`

This controls how often the scroll event will be fired while scrolling (as a time interval in ms). A lower number yields better accuracy for code that is tracking the scroll position, but can lead to scroll performance problems due to the volume of information being sent over the bridge. You will not notice a difference between values set between 1-16 as the JS run loop is synced to the screen refresh rate. If you do not need precise scroll position tracking, set this value higher to limit the information being sent across the bridge. The default value is `0`, which results in the scroll event being sent only once each time the view is scrolled.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.71/scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ Note that the view can always be scrolled by calling `scrollTo`.

---

### `scrollEventThrottle` <div class="label ios">iOS</div>
### `scrollEventThrottle`

This controls how often the scroll event will be fired while scrolling (as a time interval in ms). A lower number yields better accuracy for code that is tracking the scroll position, but can lead to scroll performance problems due to the volume of information being sent over the bridge. You will not notice a difference between values set between 1-16 as the JS run loop is synced to the screen refresh rate. If you do not need precise scroll position tracking, set this value higher to limit the information being sent across the bridge. The default value is `0`, which results in the scroll event being sent only once each time the view is scrolled.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.72/scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ Note that the view can always be scrolled by calling `scrollTo`.

---

### `scrollEventThrottle` <div class="label ios">iOS</div>
### `scrollEventThrottle`

This controls how often the scroll event will be fired while scrolling (as a time interval in ms). A lower number yields better accuracy for code that is tracking the scroll position, but can lead to scroll performance problems due to the volume of information being sent over the bridge. You will not notice a difference between values set between 1-16 as the JS run loop is synced to the screen refresh rate. If you do not need precise scroll position tracking, set this value higher to limit the information being sent across the bridge. The default value is `0`, which results in the scroll event being sent only once each time the view is scrolled.

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.73/scrollview.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ Note that the view can always be scrolled by calling `scrollTo`.

---

### `scrollEventThrottle` <div class="label ios">iOS</div>
### `scrollEventThrottle`

This controls how often the scroll event will be fired while scrolling (as a time interval in ms). A lower number yields better accuracy for code that is tracking the scroll position, but can lead to scroll performance problems due to the volume of information being sent over the bridge. You will not notice a difference between values set between 1-16 as the JS run loop is synced to the screen refresh rate. If you do not need precise scroll position tracking, set this value higher to limit the information being sent across the bridge. The default value is `0`, which results in the scroll event being sent only once each time the view is scrolled.

Expand Down

0 comments on commit 0ac8182

Please sign in to comment.