Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
reactjs-infinite-scroll-loop
Advanced tools
React component that supports infinite scrolling of finite number of elements.
Readme
<InfiniteScrollLoop {/* props here */}>
<ContentWrapper {/* props here */}>
{/* Content element 1 */}
</ContentWrapper>
<ContentWrapper {/* props here */}>
{/* Content element 2 */}
</ContentWrapper>
...
</InfiniteScrollLoop>
Custom animation when a content element is selected can be implemented by adding the custom pseudo class <className>__selected
. The animation
transition duration can be added to the target <className>
.
The following code snippets reproduce the above gif:
const Example = () => {
return (
<div style={{ height:"150px", width:"200px" }}>
<InfiniteScrollLoop>
{
Array(6).fill(0).map((v, i) => {
return <Content key={i} id={`${i+1}`} number={i+1}/>
})
}
</InfiniteScrollLoop>
</div>
);
};
interface ContentProps {
id: string;
number: number;
}
const Content = ({ id, number }: ContentProps) => {
return (
<ContentWrapper height="30%" width="100%">
<div id={id} className="container" >
<h4 className="number">{number}</h4>
</div>
</ContentWrapper>
);
};
.container {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.number {
margin: 0;
opacity: 0.2;
font-size: 18px;
transition: 0.2s;
}
.number__selected {
opacity: 1;
font-size: 25px;
}
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | None (required) | The content of the scroll container.1 |
onSelect | (selected: Element) => void | undefined | Executes a given JavaScript code on the selected element. |
verticalScroll | boolean | true | The direction of scroll. true for vertical and false for horizontal.2 |
backup | number | 50 | The number of backup content sets on the top and bottom. Increasing this number will increase the amount of scroll required to the end of the scroll container, but decreases performance as more content needs to be rendered. |
Name | Type | Default | Description |
---|---|---|---|
height | string (accept any CSS height values) | ‘auto’ | The height of each content element. |
width | string (accept any CSS width values) | ‘auto’ | The width of each content element. |
Each content element must be contained in a ContentWrapper, or a custom parent wrapper class that consists of the scroll-snap-align property. ↩
If scrollDirection is vertical, the height of scroll container must be larger than the height of each content element. If scrollDirection is horizontal, the width of scroll container must be larger than the width of each content element. ↩
FAQs
React component that supports infinite scrolling of finite number of elements.
The npm package reactjs-infinite-scroll-loop receives a total of 11 weekly downloads. As such, reactjs-infinite-scroll-loop popularity was classified as not popular.
We found that reactjs-infinite-scroll-loop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.