Skip to content

Commit

Permalink
Set collapse property to false when using createAnimatedComponent()
Browse files Browse the repository at this point in the history
Depending on the style props of an Animated.View it may be optimised away
by the NativeViewHierarchyOptimizer, which will make the animation to
fail, because the native view is virtual (it does not exists
in the native view hierarchy).
Although the createAnimatedComponent already sets the collapsable property
based on the this._propsAnimated.__isNative flag, it won't work on all
cases, since the __isNative flag is only set when one starts the animation.
Which won't cause a re-render to occuor, thus not setting the collapsable
property to false.
In order to prevent this issue the HOC will just set the collapsable property
to false.
  • Loading branch information
cabelitos committed Jun 24, 2019
1 parent 7d2a95d commit c3e8e40
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions Libraries/Animated/src/createAnimatedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ function createAnimatedComponent(Component: any, defaultProps: any): any {
// have to make sure the view doesn't get optimized away because it cannot
// go through the NativeViewHierarchyManager since it operates on the shadow
// thread.
collapsable={
this._propsAnimated.__isNative ? false : props.collapsable
}
collapsable={false}
/>
);
}
Expand Down

0 comments on commit c3e8e40

Please sign in to comment.