oblador/react-native-collapsible

Item content height gets set to zero on layout change

Open

#269 ouverte le 6 déc. 2018

Voir sur GitHub
 (15 commentaires) (10 réactions) (0 assignés)JavaScript (449 forks)github user discovery
awaiting-replyhelp wanted

Métriques du dépôt

Stars
 (2 589 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

Snack Demo of the Issue

This appears to be a continuation of the issues #210 and #105.

Context: I am working in a FlatList which has a header and some other items. The header onPress toggles the collapse of the other items. The items have an onPress which 'selects' the item, adding a background color and appending an asterisk to the text display.

Issue: After an item has been collapsed and uncollapsed, pressing an item causes it's contentHeight to recalculate to zero.

Relevant configuration: I can currently only reproduce this bug under the following conditions:

  • there must be a change in content (the addition of the asterisk to the list item text on select). Only changing backgroundColor does not trigger the issue
  • the item to be rendered is a custom component imported from another file. Writing out the entire contents of the component directly in the FlatList item render prop did not trigger the issue. You can set the state.useBreakableVersion to false to reproduce this in the snack.

Dirty Fix I can currently use the package for my use case by amending the Collapsible.js _measureContent function so that it sets measured: false on line92, but I'm assuming that this is not a sustainable change for the package.

Guide contributeur