oblador/react-native-collapsible

Item content height gets set to zero on layout change

Open

#269 创建于 2018年12月6日

在 GitHub 查看
 (15 评论) (10 反应) (0 负责人)JavaScript (449 fork)github user discovery
awaiting-replyhelp wanted

仓库指标

Star
 (2,589 star)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南