Native Animated: Prevent views driven by native animated from being optimized 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 https://github.com/facebook/react-native/pull/12983 Differential Revision: D4811420 Pulled By: javache fbshipit-source-id: f217f244baca64df2b76cbe08cce2d847c0dc985
This commit is contained in:
parent
a2e589eb23
commit
c87524e0a6
|
@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue