Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react';
import PropTypes from 'prop-types';
import autoPlay from 'react-swipeable-views-utils/lib/autoPlay';
import virtualize from 'react-swipeable-views-utils/lib/virtualize';
import bindKeyboard from 'react-swipeable-views-utils/lib/bindKeyboard';
import SwipeableViews from 'react-swipeable-views';
import { modulo } from './util';
const VirtualizeAutoPlaySwipeViews = autoPlay(bindKeyboard(virtualize(SwipeableViews)));
const carouselSlideRenderer = children =>
({ index, key }) => React.cloneElement(children[modulo(index, children.length)], { key });
const Carousel = ({ children, ...other }) => (
);
Carousel.propTypes = {
children: PropTypes.node.isRequired,
};
export default Carousel;
import React from 'react'
import autoPlay from 'react-swipeable-views-utils/lib/autoPlay'
import virtualize from 'react-swipeable-views-utils/lib/virtualize'
import bindKeyboard from 'react-swipeable-views-utils/lib/bindKeyboard'
import SwipeableViews from 'react-swipeable-views'
import { modulo } from './util'
const VirtualizeSwipeViews = bindKeyboard(virtualize(SwipeableViews))
const VirtualizeAutoPlaySwipeViews = autoPlay(VirtualizeSwipeViews)
const carouselSlideRenderer = (children) =>
({index, key}) => React.cloneElement(children[modulo(index, children.length)], {key})
export default function Carousel ({children, autoplay, ...other}) {
const slideRenderer = carouselSlideRenderer(children)
return autoplay ? (
) : (