-
-
Notifications
You must be signed in to change notification settings - Fork 788
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create one generic scrollable component (#442)
* chore: updated react-native in example * chore: updated react/react native types * chore: updated scrollable hooks * chore: deleted old scrollable components * refactor: added the new generic scrollable method
- Loading branch information
Showing
26 changed files
with
379 additions
and
471 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
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
27 changes: 27 additions & 0 deletions
27
src/components/bottomSheetScrollable/BottomSheetFlatList.tsx
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,27 @@ | ||
import { memo } from 'react'; | ||
import { | ||
FlatList as RNFlatList, | ||
FlatListProps as RNFlatListProps, | ||
} from 'react-native'; | ||
import Animated from 'react-native-reanimated'; | ||
import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; | ||
import type { | ||
BottomSheetFlatListMethods, | ||
BottomSheetFlatListProps, | ||
} from './types'; | ||
|
||
const AnimatedFlatList = Animated.createAnimatedComponent<RNFlatListProps<any>>( | ||
RNFlatList | ||
); | ||
|
||
const BottomSheetFlatListComponent = createBottomSheetScrollableComponent< | ||
BottomSheetFlatListMethods, | ||
BottomSheetFlatListProps<any> | ||
>(AnimatedFlatList); | ||
|
||
const BottomSheetFlatList = memo(BottomSheetFlatListComponent); | ||
BottomSheetFlatList.displayName = 'BottomSheetFlatList'; | ||
|
||
export default BottomSheetFlatList as <T>( | ||
props: BottomSheetFlatListProps<T> | ||
) => ReturnType<typeof BottomSheetFlatList>; |
27 changes: 27 additions & 0 deletions
27
src/components/bottomSheetScrollable/BottomSheetScrollView.tsx
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,27 @@ | ||
import { memo } from 'react'; | ||
import { | ||
ScrollView as RNScrollView, | ||
ScrollViewProps as RNScrollViewProps, | ||
} from 'react-native'; | ||
import Animated from 'react-native-reanimated'; | ||
import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; | ||
import type { | ||
BottomSheetScrollViewMethods, | ||
BottomSheetScrollViewProps, | ||
} from './types'; | ||
|
||
const AnimatedScrollView = Animated.createAnimatedComponent<RNScrollViewProps>( | ||
RNScrollView | ||
); | ||
|
||
const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent< | ||
BottomSheetScrollViewMethods, | ||
BottomSheetScrollViewProps | ||
>(AnimatedScrollView); | ||
|
||
const BottomSheetScrollView = memo(BottomSheetScrollViewComponent); | ||
BottomSheetScrollView.displayName = 'BottomSheetScrollView'; | ||
|
||
export default BottomSheetScrollView as ( | ||
props: BottomSheetScrollViewProps | ||
) => ReturnType<typeof BottomSheetScrollView>; |
27 changes: 27 additions & 0 deletions
27
src/components/bottomSheetScrollable/BottomSheetSectionList.tsx
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,27 @@ | ||
import { memo } from 'react'; | ||
import { | ||
SectionList as RNSectionList, | ||
SectionListProps as RNSectionListProps, | ||
} from 'react-native'; | ||
import Animated from 'react-native-reanimated'; | ||
import { createBottomSheetScrollableComponent } from './createBottomSheetScrollableComponent'; | ||
import type { | ||
BottomSheetSectionListMethods, | ||
BottomSheetSectionListProps, | ||
} from './types'; | ||
|
||
const AnimatedSectionList = Animated.createAnimatedComponent< | ||
RNSectionListProps<any> | ||
>(RNSectionList); | ||
|
||
const BottomSheetSectionListComponent = createBottomSheetScrollableComponent< | ||
BottomSheetSectionListMethods, | ||
BottomSheetSectionListProps<any> | ||
>(AnimatedSectionList); | ||
|
||
const BottomSheetSectionList = memo(BottomSheetSectionListComponent); | ||
BottomSheetSectionList.displayName = 'BottomSheetSectionList'; | ||
|
||
export default BottomSheetSectionList as <T>( | ||
props: BottomSheetSectionListProps<T> | ||
) => ReturnType<typeof BottomSheetSectionList>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export { default as BottomSheetSectionList } from './BottomSheetSectionList'; | ||
export { default as BottomSheetFlatList } from './BottomSheetFlatList'; | ||
export { default as BottomSheetScrollView } from './BottomSheetScrollView'; | ||
|
||
export type { | ||
BottomSheetFlatListMethods, | ||
BottomSheetScrollViewMethods, | ||
BottomSheetSectionListMethods, | ||
} from './types'; |
File renamed without changes.
Oops, something went wrong.