Permalink
Browse files

Native Animated: Prevent views driven by native animated from being o…

…ptimized away

Summary:
When using native animated we don't go through the shadow thread and use the NativeViewHierachyOptimizer so we have to make sure the views won't get optimized away. Also since we are not passing certain props because they are driven by native it is possible that the view will be marked as layout only when in fact it is not.

**Test plan**
Animated a simple view that will be collapsed with native animated and reproduce the error (it's actually just an error log in logcat now and no longer a redscreen) and checked that this fixes it.

Fixes #12975
Closes #12983

Differential Revision: D4811420

Pulled By: javache

fbshipit-source-id: f217f244baca64df2b76cbe08cce2d847c0dc985
  • Loading branch information...
janicduplessis authored and facebook-github-bot committed May 26, 2017
1 parent a2e589e commit c87524e0a6f1b411adc3d54741f7ff58faa1e38a
Showing with 7 additions and 1 deletion.
  1. +7 −1 Libraries/Animated/src/AnimatedImplementation.js
@@ -1839,10 +1839,16 @@ function createAnimatedComponent(Component: any): any {
}
render() {
const props = this._propsAnimated.__getValue();
return (
<Component
{...this._propsAnimated.__getValue()}
{...props}
ref={this._setComponentRef}
// The native driver updates views directly through the UI thread so we
// have to make sure the view doesn't get optimized away because it cannot
// go through the NativeViewHierachyManager since it operates on the shadow
// thread.
collapsable={this._propsAnimated.__isNative ? false : props.collapsable}
/>
);
}

0 comments on commit c87524e

Please sign in to comment.