import SpringContainer from './SpringContainer';
import BaseContainer from './BaseContainer';
import { IAnimatedComponentProps } from '../type';

const Container = (props: IAnimatedComponentProps) => {
  const { animated, plugin = 'linear' } = props;

  const isSequence = animated.getWebIsSequence();
  const isSpring = isSequence
    ? plugin === 'spring'
    : animated.getWebAnimatedStyle()?.config?.animationType === 'spring';

  const ContainerComponent = isSpring ? SpringContainer : BaseContainer;

  return <ContainerComponent {...props} />;
};

export default Container;
