-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scrollview)!: add CSS scroll on ScrollView (#146)
* refactor(scrollview): move scrollview to its own directory * refactor(scrollview): extract pointer logic out of ScrollView * feat(ScrollView): add CSS scrolling for scroll view * chore(example): remove align self stretch from box * chore(example): allow to pass style to box * refactor(scrollview): split into subdirectories * test(scrollview): add test for custom scroll view * chore(example): use css scroll everywhere * feat(scrollview)!: make css the default scrollview * docs(scrollview): add doc
- Loading branch information
Showing
17 changed files
with
824 additions
and
281 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
263 changes: 0 additions & 263 deletions
263
packages/lib/src/spatial-navigation/components/ScrollView.tsx
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
packages/lib/src/spatial-navigation/components/ScrollView/AnyScrollView.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,37 @@ | ||
import React from 'react'; | ||
import { ViewStyle, ScrollView } from 'react-native'; | ||
import { CustomScrollView } from './CustomScrollView/CustomScrollView'; | ||
import { CustomScrollViewRef } from './types'; | ||
|
||
type Props = { | ||
useNativeScroll: boolean; | ||
|
||
horizontal?: boolean; | ||
children: React.ReactNode; | ||
style?: ViewStyle; | ||
contentContainerStyle?: ViewStyle; | ||
scrollDuration?: number; | ||
onScroll?: (event: { nativeEvent: { contentOffset: { y: number; x: number } } }) => void; | ||
testID?: string; | ||
}; | ||
|
||
export const AnyScrollView = React.forwardRef<CustomScrollViewRef, Props>( | ||
({ useNativeScroll, ...props }: Props, ref) => { | ||
if (useNativeScroll) { | ||
return ( | ||
<ScrollView | ||
ref={ref as React.RefObject<ScrollView>} | ||
showsHorizontalScrollIndicator={false} | ||
showsVerticalScrollIndicator={false} | ||
scrollEnabled={false} | ||
scrollEventThrottle={16} | ||
{...props} | ||
/> | ||
); | ||
} | ||
|
||
return <CustomScrollView ref={ref} {...props} />; | ||
}, | ||
); | ||
|
||
AnyScrollView.displayName = 'AnyScrollView'; |
Oops, something went wrong.