React-native-collapsible: Regression: Content is laid out repeatedly during expand animation (#175)

Created on 27 Jul 2020  路  3Comments  路  Source: oblador/react-native-collapsible

Original bug described in #175; I'm opening this one because I intend to submit a PR that fixes it without causing the issue described in #197.

Copying content of original bug below for convenience.


I am trying to use <Collapsible /> with <Text />. Everything works fine except one thing: text layout changes while animation is in progress.

The result looks pretty janky:
current

The expand animation looks much better if the content is laid out just once:
improved

Most helpful comment

@brettdh @mrKorg guys, got the same issues today. Fixed both with just a parent container with flex: 1 and that's it.

const renderContent = section => {
  return (
    <View style={styles.contentContainer}> // <=== flex: 1
      <Text style={styles.content}>{section.text}</Text>  // <=== text styles
    </View>
  )
}

All 3 comments

Hi @brettdh
I have the same problem, so I updated "react-native-collapsible" from "1.5.2" to "1.5.3",
And it works with Text tag. Thanks.
But this issue have some other bug (iOs only).

I need render HTML at collapsible component. I use react-native-render-html. All HTML blocks are cropped.
image
Code like this:
<Collapsible collapsed={isCollapsed}> <View style={style.itemContent}> <HTML html={content} baseFontStyle={{...style.itemFont, ...typography[FONT_SIZES.SMALL_TEXT]}} onLinkPress={(evt, href) => Linking.openURL(href)} /> </View> </Collapsible>

And when I just add <Text /> inside Collapsible, it works fine, without cropping.

@brettdh @mrKorg guys, got the same issues today. Fixed both with just a parent container with flex: 1 and that's it.

const renderContent = section => {
  return (
    <View style={styles.contentContainer}> // <=== flex: 1
      <Text style={styles.content}>{section.text}</Text>  // <=== text styles
    </View>
  )
}

This should be fixed in 1.6.0. Can you verify?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vijay-dadhich09 picture vijay-dadhich09  路  8Comments

xxstefanoxx picture xxstefanoxx  路  4Comments

ChildishDanbino picture ChildishDanbino  路  8Comments

pkantsedalov picture pkantsedalov  路  5Comments

technicallyty picture technicallyty  路  4Comments