GithubHelp home page GithubHelp logo

Comments (3)

fjmorant avatar fjmorant commented on June 3, 2024

@mofengfs Do you have an example I could work on? Here in this example you can find that changing the data keeps the state of the nodes opened (obviously if the data is completely new is going to start from being close) https://github.com/fjmorant/react-native-nested-listview-examples/blob/master/DynamicContentExample.js

from react-native-nested-listview.

dintos07 avatar dintos07 commented on June 3, 2024

Hi,

i am also facing the same issue. Cant able to open all child nodes initially. anybody can suggest a solution for it. I listed my code below.

<NestedListView data={vehicledata}
getChildrenName={(item) => 'fleets'}
onNodePressed={category => {}}
keepOpenedState={true}
renderNode={(fleet, level) => {
return (

<View
style={[
Interfacestyle.fleetgroup,
{
backgroundColor: colorLevels[(level-1)] ,
paddingLeft: ((level-1) + 1) * 1,
},
level==2 && searchinput.length>0?{marginBottom:5}:null
]}>

                        <CheckBox 
                            containerStyle={Interfacestyle.fleetcheckbox} 
                            checked={level==1?fleetdata.group[fleet.GroupId]:level==2? (fleet.GroupId in fleetdata.stations )=== false?false:fleetdata.stations[fleet.GroupId][fleet.StationId]:(fleet.StationId in fleetdata.fleets=== false)?false:fleetdata.fleets[fleet.StationId][fleet.fleetId]} 
                            size={19} 
                            onPress={() => { level==1?selectfleet(fleet.GroupId):level==2?selectfleet(fleet.GroupId, fleet.StationId):selectfleet(fleet.GroupId, fleet.StationId,fleet.fleetId)}} 
                            style={Interfacestyle.checkbox} /> 
                        <Text style={Interfacestyle.fleetgrouptext}>{fleet.name}</Text>
                                      
                      </View>
                  </NestedRow>);
            }}>

            </NestedListView>

i listed the array below.

vehicledata=[
{
"GroupId":1,
"name":"Test1"
"fleets":
[
{

"GroupId":1,
"subgrpoup":1,
"name":"test1.1"
"fleets":
[
{
"name":"test1.1.1"
"subgrpoup":1.1.1,
"GroupId":1,
"id":1
}
],
}
],
}
]

from react-native-nested-listview.

fjmorant avatar fjmorant commented on June 3, 2024

This is fixed in the latest version of the library, take into account that if you change completely the data of the list with new one then this library starts the state from the beginning because you've never opened those new nodes

from react-native-nested-listview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.