-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33288 from ishpaul777/typeScript/InvertedFlatList
TS migration InvertedList #25137
- Loading branch information
Showing
5 changed files
with
54 additions
and
112 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
import React, {ForwardedRef, forwardRef} from 'react'; | ||
import {FlatListProps} from 'react-native'; | ||
import FlatList from '@components/FlatList'; | ||
|
||
const AUTOSCROLL_TO_TOP_THRESHOLD = 128; | ||
const WINDOW_SIZE = 15; | ||
|
||
function BaseInvertedFlatList<T>(props: FlatListProps<T>, ref: ForwardedRef<FlatList>) { | ||
return ( | ||
<FlatList | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
ref={ref} | ||
windowSize={WINDOW_SIZE} | ||
maintainVisibleContentPosition={{ | ||
minIndexForVisible: 0, | ||
autoscrollToTopThreshold: AUTOSCROLL_TO_TOP_THRESHOLD, | ||
}} | ||
inverted | ||
/> | ||
); | ||
} | ||
|
||
BaseInvertedFlatList.displayName = 'BaseInvertedFlatList'; | ||
|
||
export default forwardRef(BaseInvertedFlatList); |
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