-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(
react/scrollbar
): add scrollViewProps
to enable passing cust…
…om props to the `ScrollView` component (#939) * docs(scrollbar): add React Virtuoso integration example to the FAQ section * docs: update scrollbar page * feat: add `scrollViewProps` to enable passing custom props to the `ScrollView` component * Create tonic-ui-938.md * docs: update scrollbar page * docs: update scrollbar page
- Loading branch information
Showing
6 changed files
with
104 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@tonic-ui/react": minor | ||
--- | ||
|
||
feat(`react/scrollbar`): add `scrollViewProps` to enable passing custom props to the `ScrollView` component |
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
38 changes: 38 additions & 0 deletions
38
packages/react-docs/pages/components/scrollbar/faq-react-virtuoso.js
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,38 @@ | ||
import { Box, Scrollbar } from '@tonic-ui/react'; | ||
import { Virtuoso } from 'react-virtuoso'; | ||
import React, { forwardRef } from 'react'; | ||
|
||
const CustomScrollbar = forwardRef((inProps, ref) => { | ||
const { children, ...props } = inProps; | ||
|
||
return ( | ||
<Scrollbar | ||
overflowY="scroll" | ||
scrollViewProps={props} | ||
scrollViewRef={ref} | ||
> | ||
{children} | ||
</Scrollbar> | ||
); | ||
}); | ||
|
||
CustomScrollbar.displayName = 'CustomScrollbar'; | ||
|
||
const App = () => { | ||
return ( | ||
<Virtuoso | ||
components={{ | ||
Scroller: CustomScrollbar, | ||
}} | ||
style={{ | ||
height: 400, | ||
}} | ||
totalCount={10000} | ||
itemContent={(index) => ( | ||
<Box>Item {index}</Box> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
export default App; |
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