Skip to content

Animated.Value is not a constructor #2487

@efoken

Description

@efoken

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

I'm trying the new RNW canary and getting this error in Storybook when I try to use Animated.Value:

Uncaught TypeError: react_native__WEBPACK_IMPORTED_MODULE_2__.default.Value is not a constructor

console.log(Animated) prints the following:

{FlatList: {…}, Image: {…}, ScrollView: {…}, SectionList: {…}, Text: {…}, …}
FlatList: {$$typeof: Symbol(react.forward_ref), render: ƒ}
Image: {$$typeof: Symbol(react.forward_ref), render: ƒ}
ScrollView: {$$typeof: Symbol(react.forward_ref), render: ƒ}
SectionList: {$$typeof: Symbol(react.forward_ref), render: ƒ}
Text: {$$typeof: Symbol(react.forward_ref), render: ƒ}
View: {$$typeof: Symbol(react.forward_ref), render: ƒ}
default: {Value: ƒ, ValueXY: ƒ, Color: ƒ, Interpolation: ƒ, Node: ƒ, …}
[[Prototype]]: Object

So Animated.default.Value seems to work 😅 I don't know if this error is only Storybook related... I got this issue after updating from RNW 0.18.0 to canary

Expected behavior

Animated.Value should work without problems.

Steps to reproduce

Use following code:

import { Animated } from 'react-native';

// ...

new Animated.Value(0)

Test case

https://codesandbox.io/p/sandbox/thirsty-swirles-txtwfs

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughas: prSubject of a pull requestneeds: issue templateIssue is missing the required issue template fields

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions