Unbreak custom animated components
Summary:
Commit c9960817ee
broke `Animated.createAnimatedComponent()` for most components outside of the standard ones. This is because it will throw an exception for any component without a `viewConfig` defined, which basically no composition style component has AFAIK.
Related issues: https://github.com/facebook/react-native/issues/10825, https://github.com/oblador/react-native-vector-icons/issues/337, https://github.com/oblador/react-native-animatable/issues/70
This PR removes the check which is more treating the symptoms really – but shouldn't `setNativeProps` duck typing be enough?
Closes https://github.com/facebook/react-native/pull/10827
Differential Revision: D4178183
Pulled By: ericvicenti
fbshipit-source-id: b85cc78ed6d84dada4d476caa243332eaadb003f
This commit is contained in:
parent
61d1a4fb39
commit
31b7819b02
|
@ -1750,12 +1750,6 @@ function createAnimatedComponent(Component: any): any {
|
|||
var callback = () => {
|
||||
if (this._component.setNativeProps) {
|
||||
if (!this._propsAnimated.__isNative) {
|
||||
if (this._component.viewConfig == null) {
|
||||
var ctor = this._component.constructor;
|
||||
var componentName = ctor.displayName || ctor.name || '<Unknown Component>';
|
||||
throw new Error(componentName + ' "viewConfig" is not defined.');
|
||||
}
|
||||
|
||||
this._component.setNativeProps(
|
||||
this._propsAnimated.__getAnimatedValue()
|
||||
);
|
||||
|
|
|
@ -139,6 +139,12 @@ var NativeMethodsMixin = {
|
|||
* Manipulation](docs/direct-manipulation.html)).
|
||||
*/
|
||||
setNativeProps: function(nativeProps: Object) {
|
||||
if (!this.viewConfig) {
|
||||
var ctor = this.constructor;
|
||||
var componentName = ctor.displayName || ctor.name || '<Unknown Component>';
|
||||
invariant(false, componentName + ' "viewConfig" is not defined.');
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue