Skip to content

Commit 7b2ee71

Browse files
obladorgrabbou
authored andcommitted
Unbreak custom animated components
Summary: Commit c996081 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: #10825, oblador/react-native-vector-icons#337, oblador/react-native-animatable#70 This PR removes the check which is more treating the symptoms really – but shouldn't `setNativeProps` duck typing be enough? Closes #10827 Differential Revision: D4178183 Pulled By: ericvicenti fbshipit-source-id: b85cc78ed6d84dada4d476caa243332eaadb003f
1 parent 9661d72 commit 7b2ee71

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Libraries/Animated/src/AnimatedImplementation.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,12 +1735,6 @@ function createAnimatedComponent(Component: any): any {
17351735
var callback = () => {
17361736
if (this._component.setNativeProps) {
17371737
if (!this._propsAnimated.__isNative) {
1738-
if (this._component.viewConfig == null) {
1739-
var ctor = this._component.constructor;
1740-
var componentName = ctor.displayName || ctor.name || '<Unknown Component>';
1741-
throw new Error(componentName + ' "viewConfig" is not defined.');
1742-
}
1743-
17441738
this._component.setNativeProps(
17451739
this._propsAnimated.__getAnimatedValue()
17461740
);

Libraries/Renderer/src/renderers/native/NativeMethodsMixin.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ var NativeMethodsMixin = {
139139
* Manipulation](docs/direct-manipulation.html)).
140140
*/
141141
setNativeProps: function(nativeProps: Object) {
142+
if (!this.viewConfig) {
143+
var ctor = this.constructor;
144+
var componentName = ctor.displayName || ctor.name || '<Unknown Component>';
145+
invariant(false, componentName + ' "viewConfig" is not defined.');
146+
}
147+
142148
if (__DEV__) {
143149
warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
144150
}

0 commit comments

Comments
 (0)