<commit_before>import React from 'react';
import classNames from 'classnames';
import ReactCarousel from 'nuka-carousel';
import assign from 'object-assign';
import CarouselProps from './PropsType';

export default class Carousel extends React.Component<CarouselProps, any> {
  static defaultProps = {
    prefixCls: 'am-carousel',
    dots: true,
    arrows: false,
    autoplay: false,
    infinite: false,
    edgeEasing: 'linear',
    cellAlign: 'center',
    selectedIndex: 0,
  };

  constructor(props) {
    super(props);
    this.state = {
      selectedIndex: this.props.selectedIndex,
    };
  }

  onChange = (index) => {
    this.setState({ selectedIndex: index });
  }

  render() {
    const { className, prefixCls } = this.props;
    let props = assign({}, this.props);
    props = assign(props, {
      wrapAround: props.infinite,
      slideIndex: props.selectedIndex,
      beforeSlide: props.beforeChange,
      afterSlide: props.afterChange,
    });
<commit_msg>fix Carousel afterChange, close #711<commit_after>import React from 'react';
import classNames from 'classnames';
import ReactCarousel from 'nuka-carousel';
import assign from 'object-assign';
import CarouselProps from './PropsType';

export default class Carousel extends React.Component<CarouselProps, any> {
  static defaultProps = {
    prefixCls: 'am-carousel',
    dots: true,
    arrows: false,
    autoplay: false,
    infinite: false,
    edgeEasing: 'linear',
    cellAlign: 'center',
    selectedIndex: 0,
  };

  constructor(props) {
    super(props);
    this.state = {
      selectedIndex: this.props.selectedIndex,
    };
  }

  onChange = (index) => {
    this.setState({
      selectedIndex: index,
    }, () => {
      if (this.props.afterChange) {
        this.props.afterChange(index);
      }
    });
  }

  render() {
    const { className, prefixCls } = this.props;
    let props = assign({}, this.props);
    props = assign(props, {
      wrapAround: props.infinite,
      slideIndex: props.selectedIndex,
      beforeSlide: props.beforeChange,
    });

{'fraction_non_alphanumeric': 0.1253035454103934, 'fraction_numerical': 0.0024283632831471587, 'mean_word_length': 3.195519348268839, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5540920', 'n_tokens_mistral': 639, 'n_tokens_neox': 628, 'n_words': 153}