Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-scrollable-feed
Advanced tools
Perfect for any chat UI or any kind of feed.
View a live demo here.
npm install --save react-scrollable-feed
import * as React from 'react'
import ScrollableFeed from 'react-scrollable-feed'
class App extends React.Component {
render() {
const items = ['Item 1', 'Item 2'];
return (
<ScrollableFeed>
{items.map((item, i) => <div key={i}>{item}</div>)}
</ScrollableFeed>
);
}
}
forceScroll
boolean
false
If set to true, will scroll to the bottom after each update on the component. By default, if the scrollable section is not at the bottom before the update occurs, it will leave the scroll at the same position.
animateScroll
(element: HTMLElement, offset: number) => void
element.scrollBy({ top: offset });
Allows to override the scroll animation by any implementation.
onScrollComplete
() => void
() => {}
Is called after the scroll animation has been executed.
changeDetectionFilter
(previousProps: ScrollableFeedComponentProps, newProps: ScrollableFeedComponentProps) => boolean
() => true
Allows to customize when the scroll should occur. This will be called everytime a componentDidUpdate
happens, which means everytime one of the props changes. You will receive as parameters the previous and the new props.
Note: ScrollableFeedComponentProps
is defined as Readonly<{ children?: ReactNode }> & Readonly<ScrollableFeedProps>
If you want to compare the last children from both the previous and new props, you could do something like this :
import * as React from 'react'
import ScrollableFeed from 'react-scrollable-feed'
class App extends React.Component {
changeDetectionFilter(previousProps, newProps) {
const prevChildren = previousProps.children;
const newChildren = newProps.children;
return prevChildren !== newChildren
&& prevChildren[prevChildren.length - 1] !== newChildren[newChildren.length - 1];
}
render() {
const items = ['Item 1', 'Item 2'];
return (
<ScrollableFeed
changeDetectionFilter={this.changeDetectionFilter}
>
{items.map((item, i) => <div key={i}>{item}</div>)}
</ScrollableFeed>
);
}
}
export default App;
viewableDetectionEpsilon
number
2
Indicates the number of pixels of difference between the actual bottom and the current position that can be tolerated. The default setting should be fine for most use cases.
For more details on how to integrate react-scrollable-feed in your application, have a look at the example folder.
MIT © Gabriel Bourgault
FAQs
react-scrollable-feed Smart scrolling for chat UIs and feeds <img al
We found that react-scrollable-feed demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.