react-native-carousel-wrapper
This library is React Native wrapper of popular Native carousel library iCarousel for ios and CarouselLayoutManager, Coverflow for Android.
Android is coming soon.
Getting started
$ npm install react-native-carousel-wrapper --save
Mostly automatic installation
$ react-native link react-native-carousel-wrapper
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-carousel-wrapper
and addRNCarouselWrapper.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNCarouselWrapper.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNCarouselWrapperPackage;
to the imports at the top of the file - Add
new RNCarouselWrapperPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-carousel-wrapper' project(':react-native-carousel-wrapper').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-carousel-wrapper/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-carousel-wrapper')
Usage
Carousel Types
Property Type
iCarousel supports the following built-in display types:
- iCarouselTypeLinear
- iCarouselTypeRotary
- iCarouselTypeInvertedRotary
- iCarouselTypeCylinder
- iCarouselTypeInvertedCylinder
- iCarouselTypeWheel
- iCarouselTypeInvertedWheel
- iCarouselTypeCoverFlow
- iCarouselTypeCoverFlow2
- iCarouselTypeTimeMachine
- iCarouselTypeInvertedTimeMachine
example:
<RNCarouselWrapper type=RNCarouselWrapperTypeiCarouselTypeRotary></RNCarouselWrapper>
; // TODO: What to do with the module? <{}> { return <RNCarouselWrapper style=stylescontainer type=RNCarouselWrapperTypeiCarouselTypeRotary> <View style=width: 100 height: 100 backgroundColor: 'blue' margin: 5><Text>1</Text></View> <View style=width: 100 height: 100 backgroundColor: 'blue' margin: 5><Text>2</Text></View> <View style=width: 100 height: 100 backgroundColor: 'blue' margin: 5><Text>3</Text></View> <View style=width: 100 height: 100 backgroundColor: 'blue' margin: 5><Text>4</Text></View> <View style=width: 100 height: 100 backgroundColor: 'blue' margin: 5><Text>5</Text></View> </RNCarouselWrapper> ; }