react-native-collapsible icon indicating copy to clipboard operation
react-native-collapsible copied to clipboard

Animated subviews in <Collapsible /> don't work

Open paolospag opened this issue 7 years ago • 2 comments

Hi, I created a custom Checkbox component with animated check icon that should work like this: animated-checkbox

but if I put the animated component inside <Collapsible /> component the animation stops working and the end result is the same as this: unanimated-checkbox

Note: the speed of the gifs has been slowed down to allow for understanding the animation.

I looked at the code of <Collapsible /> component and I noticed something that could block all other animation: https://github.com/oblador/react-native-collapsible/blob/master/Collapsible.js#L145-L147 according to the documentation:

By default, if one animation is stopped or interrupted, then all other animations in the group are also stopped.

Any workaround?

paolospag avatar Apr 16 '19 12:04 paolospag

I did run into an issues with animations, breaking if they were triggered during a collapsible (open) animation. The trick was to hook the collapsible animation end before firing animation events on my own components.

<Collapsible collapsed={!this.state.collapsible} onAnimationEnd={this.onCollapseAnimationEnd}>

Further i had issues if the collapsible contents view had dynamic height

<Collapsible collapsed={!this.state.collapsible}>
           <View ref={element => this.collapsibleRef = element} style={[{height:SOME_FIXED_HEIGHT}]}><MyComponent></MyComponent></View>
             </Collapsible>

giantslogik avatar Apr 22 '19 12:04 giantslogik

Hey could you link to the source for that checkbox? Would love to do some testing.

iRoachie avatar Jul 26 '19 02:07 iRoachie