diff --git a/docs/pager.md b/docs/pager.md index 62234bf79..c235ef995 100644 --- a/docs/pager.md +++ b/docs/pager.md @@ -66,13 +66,15 @@ Pages in both [`HorizontalPager`][api-horizpager] and [`VerticalPager`][api-vert ### Offscreen Limit -Both [`HorizontalPager`][api-horizpager] & [`VerticalPager`][api-vertpager] allow the setting of the `offscreenLimit`, which defines the number of pages that should be retained on either side of the current page. Pages beyond this limit will be removed, and then recreated when needed. This value defaults to `1`, but can be increased to enable pre-loading of more content: +The [PagerState][pagerstate-api] API allows the setting of the `offscreenLimit`, which defines the number of pages that should be retained on either side of the current page. Pages beyond this limit will be removed, and then recreated as needed. This value defaults to `1`, but can be increased to enable pre-loading of more content: ```kotlin -HorizontalPager( - state = pagerState, +val pagerState = rememberPagerState( + pageCount = 10, offscreenLimit = 2, -) { page -> +) + +HorizontalPager(state = pagerState) { page -> // ... } ``` @@ -249,4 +251,5 @@ limitations under the License. [api-horizpager]: ../api/pager/pager/com.google.accompanist.pager/-horizontal-pager.html [currentpage-api]: ../api/pager/pager/com.google.accompanist.pager/-pager-state/current-page.html [currentpageoffset-api]: ../api/pager/pager/com.google.accompanist.pager/-pager-state/current-page-offset.html - [calcoffsetpage]: ../api/pager/pager/com.google.accompanist.pager/calculate-current-offset-for-page.html) \ No newline at end of file + [calcoffsetpage]: ../api/pager/pager/com.google.accompanist.pager/calculate-current-offset-for-page.html + [pagerstate-api]: ../api/pager/pager/com.google.accompanist.pager/remember-pager-state.html \ No newline at end of file