Skip to content

Commit c3e8e40

Browse files
committed
Set collapse property to false when using createAnimatedComponent()
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.
1 parent 7d2a95d commit c3e8e40

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Libraries/Animated/src/createAnimatedComponent.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ function createAnimatedComponent(Component: any, defaultProps: any): any {
156156
// have to make sure the view doesn't get optimized away because it cannot
157157
// go through the NativeViewHierarchyManager since it operates on the shadow
158158
// thread.
159-
collapsable={
160-
this._propsAnimated.__isNative ? false : props.collapsable
161-
}
159+
collapsable={false}
162160
/>
163161
);
164162
}

0 commit comments

Comments
 (0)