Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
react-smooth-draggable-list
Advanced tools
Readme
smooth, mobile-friendly, draggable list component for react.
:star: Check out the Demo :star:
This component can be installed with npm:
npm install react-smooth-draggable-list --save
import List from 'react-smooth-draggable-list'
const items = [1, 2, 3]
<List rowHeight={80}>{
items.map(item => <List.Item>item {item}</List.Item>)
}</List>
class MyList extends React.Component {
// order index starts at zero
state = {order: [1, 0, 2]}
render() {
return (
<List
rowHeight={50}
order={this.state.order}
onReOrder={order => this.setState({order})}
>
<List.Item>item 1</List.Item>
<List.Item>item 2</List.Item>
<List.Item>item 3</List.Item>
</List>
)
}
}
You can find more examples in the demo source code.
Name | Type | Default | Description |
---|---|---|---|
order | array | null | order is optional - when it is not defined, the list will be uncontrolled. |
onReOrder | (order) => {} | null | The onReOrder callback is invoked every time a user changes the list order. order is a list of integers representing the order of items. |
rowHeight | integer | 0 | Required: RowHeight defines the height of each list item in pixels. |
rowWidth | integer | null | RowWidth defines the width of the list component in pixels. Width defaults to 100% of parent. |
gutter | number | null | Amount of space between list items in pixels. Defaults to 0.1 * props.rowHeight . |
springConfig | object | null | Drag animation control. Object has three keys. stiffness : optional, defaults to 300 . damping : optional, defaults to 50 . precision : optional, defaults to 0.05 . |
Name | Type | Default | Description |
---|---|---|---|
dragHandle | Component | null | Pass in a functional component. See DragHandle in demo source code for an example. |
disabled | boolean | false | Allows user to disable list items. |
# install with dev dependencies
npm install react-smooth-draggable-list --save-dev
# run the dev server on port 2100
npm run dev
npm run dev
will run a dev server with hot reloading enabled. The dev server runs at http://localhost:2100. Dev server source code is here.
FAQs
smooth, mobile-friendly, draggable list for react.
We found that react-smooth-draggable-list 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
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).