Skip to content

Commit d1bba78

Browse files
author
Javier Morant
authored
Update readme file to version v0.2.0 (#22)
* Updated gifs * Added props to NestedRow * Updated Readme file * Remove basic gif
1 parent 6354c21 commit d1bba78

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ UI component for React Native that allows to create a listview with N levels of
1111
[![github release](https://img.shields.io/github/release/fjmorant/react-native-nested-listview.svg?style=flat-square)](https://github.com/fjmorant/react-native-nested-listview/releases)
1212

1313

14-
![react-native-nested-listview](https://imgur.com/OqvopyK.gif)
15-
16-
1714
## Table of contents
1815

16+
1. [Show](#show)
1917
1. [Usage](#usage)
2018
1. [Props](#props)
2119
1. [Example](#example)
2220
1. [Roadmap](#roadmap)
2321

22+
## Show
23+
![react-native-nested-listview](https://i.imgur.com/Y3VFTry.gif)
24+
![react-native-nested-listview](https://i.imgur.com/nJvl0ZT.gif)
2425

2526
## Usage
2627

@@ -29,7 +30,7 @@ yarn add react-native-nested-listview
2930
```
3031

3132
```javascript
32-
import NestedListview from 'react-native-nested-listview'
33+
import NestedListview, {NestedRow} from 'react-native-nested-listview'
3334

3435
const data = [{title: 'Node 1', items: [{title: 'Node 1.1'}, {title: 'Node 1.2'}]}]
3536

@@ -38,16 +39,19 @@ const data = [{title: 'Node 1', items: [{title: 'Node 1.1'}, {title: 'Node 1.2'}
3839
getChildrenName={(node) => 'items'}
3940
onNodePressed={(node) => alert('Selected node')}
4041
renderNode={(node, level) => (
41-
<View style={styles.row}>
42+
<NestedRow
43+
level={level}
44+
style={styles.row}
45+
>
4246
<Text>{node.title}</Text>
43-
</View>
47+
</NestedRow>
4448
)}
4549
/>
4650
```
4751

4852
## Props
4953

50-
### Required
54+
### NestedListView
5155

5256
Prop | Description | Type | Default
5357
------ | ------ | ------ | ------
@@ -56,12 +60,20 @@ Prop | Description | Type | Default
5660
**`getChildrenName`** | Function to determine in a node where are the children, by default NestedListView will try to find them in **items** | Function | **items**
5761
**`onNodePressed`** | Function called when a node is pressed by a user | Function | Not required
5862

63+
### NestedRow
64+
65+
Prop | Description | Type | Default
66+
------ | ------ | ------ | ------
67+
**`height`** | Height of the row | number | 50
68+
**`children`** | Content of the NestedRow | Component | **Required**
69+
**`level`** | Level where a given node is | number | **Required**
70+
**`style`** | NestedRow container style | Style | Not required
71+
5972
## Example
60-
You can find the following example in the [`/example` folder](https://github.com/fjmorant/react-native-nested-listview/tree/master/example).
73+
You can find the following example in the [`/examples` folder](https://github.com/fjmorant/react-native-nested-listview/tree/master/example).
6174

6275
## Roadmap
6376

6477
- Autoscrolling optionally
6578
- Expand/contract nodes programatically
66-
- Support animations
67-
- Add more examples of usage
79+
- Support animations

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ const styles = StyleSheet.create({
3434
})
3535

3636
export class NestedRow extends React.PureComponent<Props, State> {
37+
props: {
38+
height?: number,
39+
children: any,
40+
level: number,
41+
style?: any,
42+
}
43+
3744
render() {
3845
const {height = 50, children, level, style} = this.props
3946

0 commit comments

Comments
 (0)