advanced-react-native-sortable-list
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "advanced-react-native-sortable-list", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A versatile list component that helps you generate a list whose items can be sorted.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -7,11 +7,22 @@ ## advanced-react-native-sortable-list | ||
### Running the example | ||
### Usage | ||
Do the following to run the example. | ||
Wrap the rendered items with the `DraggableList` component imported from `advanced-react-native-sortable-list` like below. | ||
1. Clone the repo. | ||
2. `cd example && yarn install` | ||
3. `yarn start` | ||
4. `yarn android` or `yarn ios` depending on your target device. | ||
```typescript jsx | ||
<DraggableList | ||
onDragEnd={onDragEnd} | ||
rowHeight={100} | ||
rowCount={data.length}> | ||
{data.map(({ name, info }) => { | ||
return (<RowItem id={name} key={name} name={name} info={info} />); | ||
})} | ||
</DraggableList> | ||
``` | ||
**Note:** Make sure to give each row item a unique id. The lib uses this id to sense any changes to the order of items in the rendered list. | ||
`onDragEnd`: This is a callback which is invoked as and when the user changes the order of the displayed items. You can listen to this, to update the component | ||
state or to perform other side effects. | ||
### Screencast | ||
@@ -21,2 +32,12 @@ | ||
### Roadmap | ||
1. Currently, the component does not adapt to elements with varying heights but rather assumes all elements to be of fixed height. I am actively working to support rows of varying heights. | ||
2. Support for horizontally scrolling list. | ||
### Contributing | ||
* Pull requests and questions are welcome. 😄 | ||
### Inspiration | ||
@@ -23,0 +44,0 @@ |
33317
29
665
45