Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Demo3 (todoList), TransitionMotion: "defaultStyles" and "styles" => got object, array expected

See original GitHub issue

I’m adapting react-motion (stable) demos in our very new template app (meteor-react-es6), to transform each of them in a single component (ex: <DraggableList/>), using react-motion npm package and React.Component (instead of React.createClass).

So it only demands a syntax adaptation, but variables still the same…

The original file


My component

here (shortcut to TransitionMotion)


Warning: Failed propType: Invalid prop "defaultStyles" of type "object" supplied to "TransitionMotion", expected an array. Check the render method of "ListAnimated"

Warning: Failed propType: Invalid prop "styles" supplied to "TransitionMotion". Check the render method of "ListAnimated"

Error Uncaught TypeError: is not a function

Any idea guys??

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

nkbtcommented, Apr 15, 2016

your code

  // actual animation-related logic
  getDefaultValue() {
    const {todos} = this.state;
    return Object.keys(todos)
      .reduce((configs, date) => {
        configs[date] = {
          height:  spring(0),
          opacity: spring(1),
          data:    todos[date],
        return configs;
      }, {});

original code

  getDefaultStyles() {
    return => ({...todo, style: {height: 0, opacity: 1}}));

getDefaultStyles returned array of styles. getDefaultValue returns object. Object does not have map method.

nkbtcommented, Apr 19, 2016

@MadeInMoon ah, sorry, I thought you are going to PR these changes to react-motion.

I am closing this for now, feel free to ping me in or Reactiflux if you need more help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Array.from() - JavaScript - MDN Web Docs
The Array.from() static method creates a new, shallow-copied Array instance from an iterable or array-like object.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found