forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move pagination size to getInitialPaginationSize
- Loading branch information
Showing
5 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
6 changes: 6 additions & 0 deletions
6
src/pages/home/report/getInitialPaginationSize/index.native.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import CONST from '@src/CONST'; | ||
|
||
function getInitialPaginationSize(): number { | ||
return CONST.MOBILE_PAGINATION_SIZE; | ||
} | ||
export default getInitialPaginationSize; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as Browser from '@libs/Browser'; | ||
import CONST from '@src/CONST'; | ||
|
||
const isMobileChrome = Browser.isMobileChrome(); | ||
const isMobileSafari = Browser.isMobileSafari(); | ||
|
||
function getInitialPaginationSize(numToRender: number): number { | ||
if (isMobileChrome || isMobileSafari) { | ||
return Math.round(Math.min(numToRender / 3, CONST.MOBILE_PAGINATION_SIZE)); | ||
} | ||
// WEB: Calculate and position it correctly for each frame, enabling the rendering of up to 50 items. | ||
return CONST.WEB_PAGINATION_SIZE; | ||
} | ||
export default getInitialPaginationSize; |