Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to display third level children ? #191

Closed
azamkth opened this issue Jul 6, 2020 · 5 comments
Closed

Is it possible to display third level children ? #191

azamkth opened this issue Jul 6, 2020 · 5 comments

Comments

@azamkth
Copy link

azamkth commented Jul 6, 2020

Example:
{
name: 'Fruits',
id: 0,
children1: [
{
name: 'Apple',
id: 10,
children2: [
{
name: 'Apple something',
id: 60,
},
]
},
{
name: 'Strawberry',
id: 17,
},
],
},

@renrizzolo
Copy link
Owner

Unforutnately this isn't supported. There may be a way to do it yourself with the upcoming version, which has a bit more flexibility for customization.

@azamkth
Copy link
Author

azamkth commented Jul 6, 2020

thanks for you prompt reply. Could you guide me how i can achieve this using your library?

@renrizzolo
Copy link
Owner

I had a look into it, and this is not currently possible, sorry.

@T0mAl3x
Copy link

T0mAl3x commented Aug 27, 2021

Hello!

I managed to do a workaround until a feature with multiple layers of children is avaible.
I copied the source code locally and updated RowItem in FlatList render method:

_renderSubItemFlatList = (
    subItem,
    subKey,
    uniqueKey,
    selectedItems,
    subItemsFlatListProps
) => {
    return <View>
      <RowSubItem
        _toggleSubItem={this._toggleSubItem}
        subItem={subItem}
        highlightedChildren={this.props.highlightedChildren}
        {...this.props}
      />
      {subItem[subKey] && (
        <FlatList
          style={{marginStart: 10}}
          keyExtractor={(i) => `${i[uniqueKey]}`}
          data={subItem[subKey]}
          extraData={selectedItems}
          ItemSeparatorComponent={this._renderSubSeparator}
          renderItem={({ item }) =>
            this._renderSubItemFlatList(
              item,
              subKey,
              uniqueKey,
              selectedItems,
              subItemsFlatListProps
            )
          }
          initialNumToRender={20}
          {...subItemsFlatListProps}
        />
      )}
    </View>;
  };

FlatList in render method

<FlatList
            keyExtractor={(i) => `${i[uniqueKey]}`}
            data={item[subKey]}
            extraData={selectedItems}
            ItemSeparatorComponent={this._renderSubSeparator}
            renderItem={({ item }) =>
              this._renderSubItemFlatList(
                item,
                subKey,
                uniqueKey,
                selectedItems,
                subItemsFlatListProps
              )
            }
            initialNumToRender={20}
            {...subItemsFlatListProps}
          />

@KarasuShin
Copy link

I create a PR to feature it #279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants