Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting TypeError: Cannot assign to read only property 'animation' of object '#<Object>' when running jest test #6

Open
jtstodola opened this issue Oct 22, 2020 · 1 comment

Comments

@jtstodola
Copy link

jtstodola commented Oct 22, 2020

TypeError: Cannot assign to read only property 'animation' of object '#<Object>'

      at getDerivedStateFromProps (node_modules/react-native-linear-animated-gradient-transition/lib/commonjs/index.tsx:48:8)
      at applyDerivedStateFromProps (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:3857:22)
      at mountClassInstance (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:4266:5)
      at updateClassComponent (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8310:5)
      at beginWork$1 (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10076:16)
      at performUnitOfWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14694:12)
      at workLoopSync (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14667:22)
      at performSyncWorkOnRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14366:11)
      at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2063:24
      at unstable_runWithPriority (node_modules/scheduler/cjs/scheduler.development.js:818:12)
@jtstodola
Copy link
Author

It looks like this can be fixed by adding the following to the bottom of the src/index.tsx

AnimatedGradientTransition.defaultProps = {
  colors: [],
  animation: {
    toValue: 1,
    duration: 500,
    easing: Easing.linear,
    useNativeDriver: true,
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant