clipChildren for Transition
- Dominant language
- Kotlin
- Stars
- 7.8k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
## Version
> master
## Issues and Steps to Reproduce
child larger than parent and enable clipChildren , wish Animation will be right.
https://user-images.githubusercontent.com/1910405/120145518-3b9ac580-c216-11eb-959c-870cb6b354c1.mp4
## Expected Behavior
show right `clip` height when transitioning.
## Link to Code
```
@LayoutSpec
public class BoundsAnimationComponentSpec {
@OnCreateLayout
static Component onCreateLayout(
ComponentContext c,
@State boolean autoBoundsTransitionEnabled) {
return Row.create(c)
.backgroundColor(Color.RED)
.child(Row.create(c).widthDip(200).heightDip(200).backgroundColor(Color.BLUE).clipChildren(true)
.child(Row.create(c).backgroundColor(Color.YELLOW).heightDip(autoBoundsTransitionEnabled?110: 340).clipChildren(true).widthDip(200).clickHandler(BoundsAnimationComponent.onABTClick(c))).build())
.build();
}
@OnEvent(ClickEvent.class)
static void onABTClick(ComponentContext c) {
BoundsAnimationComponent.toggleABTSync(c);
}
@OnUpdateState
static void toggleABT(StateValue autoBoundsTransitionEnabled) {
autoBoundsTransitionEnabled.set(!autoBoundsTransitionEnabled.get());
}
@OnCreateTransition
static Transition animate(ComponentContext c, @State boolean autoBoundsTransitionEnabled) {
return Transition.allLayout().animator(Transition.timing(2000));
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.