diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js index afed957d2ab3b1..55df0563892923 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedObject.js @@ -24,11 +24,14 @@ export function isPlainObject( /* $FlowFixMe[incompatible-type-guard] - Flow does not know that the prototype and ReactElement checks preserve the type refinement of `value`. */ ): value is $ReadOnly<{[string]: mixed}> { + const proto = value !== null && typeof value === 'object' ? Object.getPrototypeOf(value) : undefined; + if (proto === undefined) { + // $FlowFixMe[incompatible-type-guard] + return false; + } return ( // $FlowFixMe[incompatible-type-guard] - value !== null && - typeof value === 'object' && - Object.getPrototypeOf(value).isPrototypeOf(Object) && + (proto == null || proto.isPrototypeOf(Object)) && !isValidElement(value) ); }