message: Called onRest when progress hits 1
diff: @@ -16,18 +16,22 @@ class Motion extends React.Component {
  }
  move() {
  this.setState(({items: prevItems, update}) => {
  - var {data, enter, leave, getKey} = this.props;
  + var {data, enter, leave, getKey, onRest} = this.props;
  var dataByKey = data.reduce((acc, item) => ({...acc, [getKey(item)]: item}), {});
  var itemsByKey = items.reduce((acc, item) => ({...acc, [item.key]: item}), {});
  var tick = performance.now();
  var items = prevItems
  .map(item => {
  var end = !dataByKey[item.key] ? leave(item.data) : update(item.data);
  - const equal = areEqual(item.end, end);
  + var equal = areEqual(item.end, end);
  + var rest = item.progress === 1 && !item.rest;
  var progress = equal ? Math.max(Math.min((tick - item.tick) / 500, 1), 0) : 0;
  var interpolators = equal ? item.interpolators : this.getInterpolators(item.style, end);
  var style = this.interpolateStyle(interpolators, end, progress);
  - return {key: item.key, data: item.data, style, end, interpolators, progress, tick};
  + if (rest) {
  + onRest(item.data, item.key);
  + }
  + return {key: item.key, data: item.data, style, end, interpolators, progress, tick, rest};
  })
  .concat(data
  .filter(item => !itemsByKey[getKey(item)])
  @@ -35,7 +39,7 @@ class Motion extends React.Component {
  var style = enter(item);
  var end = update(item);
  var interpolators = this.getInterpolators(style, end);
  - return {key: getKey(data), data: item, style, end, interpolators, progress: 0, tick};
  + return {key: getKey(data), data: item, style, end, interpolators, progress: 0, tick, rest: false};
  })
  );
  this.moveId = requestAnimationFrame(this.move);
  