Comments (4)
Hi @brystfire08 ,
IN you example children and descendants are objects and that structure is not currently supported in this library, they have to be arrays, one possibility is to convert them into arrays if possible.
Sorry I think I am going to add this in the roadmap to make the library a bit more flexible.
Thank you very much.
from react-native-nested-listview.
PR for it @brystfire08 #73
I need to check several aspects but this is the initial approach
from react-native-nested-listview.
Thank you so much 👍
Now I can remove the recursive iteration to make my Object an array of Objects.
I just have to add Object.values() on the data prop passed to the NestedListView component
<View style={styles.container}>
<NestedListView
data={Object.values(mainObj)}
getChildrenName={this.getChildrenName}
onNodePressed={this.onNodePressed}
renderNode={this.renderNode}
/>
</View>
because sometimes the object can be like this:
{
"1":{
name: 'Main Parent',
descendants: {
"1":{
name: "Main Child 1",
children: {
"1":{
name: "Sub Child 1",
children:{}
},
"2":{
name: "Sub Child 2",
children:{
name: "Sample",
children:{}
}
}
}
},
"2":{
name: "Main Child 2",
children: {
"1":{
name: "Sub Child 1",
children:{}
},
"2":{
name: "Sub Child 2",
children:{}
}
}
},
}
},
"2":{
name: 'Main Parent',
descendants: {
"1":{
name: "Main Child 1",
children: {
"1":{
name: "Sub Child 1",
children:{}
},
"2":{
name: "Sub Child 2",
children:{
name: "Sample",
children:{}
}
}
}
},
"2":{
name: "Main Child 2",
children: {
"1":{
name: "Sub Child 1",
children:{}
},
"2":{
name: "Sub Child 2",
children:{}
}
}
},
}
},
}
from react-native-nested-listview.
Wrote that functionality in this branch https://github.com/fjmorant/react-native-nested-listview/tree/childrenAsObject soon I will create a PR and it will be available
from react-native-nested-listview.
Related Issues (20)
- Inconsistent typescript definition for onNodePressed
- Appears to be a git repo or submodule. HOT 3
- i want dynamic height of row HOT 3
- How to search in react-native-nested-listview? HOT 2
- Fix warnings for lifecycle events HOT 1
- Remove flow dependency
- Dynamic height for each row
- How to add two icons "+" and "-" in NestedListView HOT 3
- Application slowed HOT 8
- `keepOpenState={true}` no effect HOT 3
- How to judge is the last level, because my data level is not fixed. HOT 3
- Rendering is slow after onNodePressed HOT 4
- Bug when use Nested-listview and Scroll View HOT 4
- Bug app HOT 2
- automatically close list view when setState parent component in v 0.11.3 HOT 5
- Cann't use with state redux HOT 3
- Render is slow when there is a lot of data HOT 6
- Export the function of render child nodes, don't render automatically HOT 1
- How to hide vertical scroll bar indicator
- onScroll event not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-nested-listview.