UNPKG

react-native-carousel-wrapper

Version:

This library is React Native wrapper of popular Native carousel library [iCarousel](https://github.com/PhilJay/MPAndroidChart) for ios and [CarouselLayoutManager](https://github.com/Azoft/CarouselLayoutManager), [Coverflow](https://github.com/crosswall/A

32 lines (28 loc) 960 B
import React from 'react'; import { NativeModules, requireNativeComponent, Platform } from 'react-native'; const { RNCarouselManager } = NativeModules; import PropTypes from 'prop-types'; import createClass from 'create-react-class'; const Carousel = createClass({ propTypes: { wrap: PropTypes.bool, items: PropTypes.array, vertical: PropTypes.bool, bounces: PropTypes.bool, scrollEnabled: PropTypes.bool, type: PropTypes.number, perspective: PropTypes.number, decelerationRate: PropTypes.number, scrollSpeed: PropTypes.number, bounceDistance: PropTypes.number, onPressItem: PropTypes.func }, render: function () { return ( <RNCarousel {...this.props} /> ); } }); const RNCarousel = requireNativeComponent('RNCarousel', Carousel); Carousel.Type = Platform.OS === 'ios' ? RNCarouselManager.Type: {}; export default Carousel;