Monadical-SAS/redux-time

"Animate" is undefined?

Closed this issue · 3 comments

Hello – I might be missing something obvious here, but it looks like Animate isn't exported from main?

Installed via yarn add redux-time, I'm using ES6 with Typescript

import { Animate } from "redux-time";

const simpleAnimation = Animate({
  path: "/progress",
  start_state: 0,
  end_state: 100,
  duration: 2000,
});

export const startAnimation = () =>
  (dispatch: Dispatch<IAppState>, getState: () => IAppState) => {
  dispatch({type: 'ANIMATE', animation: simpleAnimation});
};

If I import * as ANIMATE from "redux-time"; console.log(ANIMATE) first, I see:

image

Hello @ethanbond, can you try importing Animate from /node/animations?

import { Animate } from 'redux-time/node/animations'

Have a nice day!

Thanks @MiltonLn that seems to have worked! Also had to add babel-runtime to my repo, and also not kick off the Animate({}) call where I did...

Thank you for the help, excited to play around with this.

Fixed the docs here: 70a1327

Keep in mind that calling Animate does not kick off the animation, it merely creates the animation object. To actually start the animation you have to dispatch it to the redux store {type: ANIMATE, ...} where you ran startAnimation.