Carousel
Carousel for scrolling pages
(code example)
info
This component extends ScrollView props.
tip
This component support **** modifiers.


Usage
Live Editor
function Example(props) { const BACKGROUND_COLORS = [ Colors.red50, Colors.yellow20, Colors.purple50, Colors.green50, Colors.cyan50, Colors.purple20, Colors.blue60, Colors.red10, Colors.green20, Colors.purple60 ]; const Page = ({children, style, ...others}) => { return ( <View {...others} style={[{flex: 1, borderWidth: 1, borderRadius: 8}, style]}> {children} </View> ); }; return ( <div> <View style={{width: 800}}> <Carousel autoplay // onChangePage={onChangePage} pageWidth={800 - Spacings.s5 * 2} itemSpacings={Spacings.s3} containerMarginHorizontal={Spacings.s2} initialPage={2} containerStyle={{height: 160}} pageControlPosition={Carousel.pageControlPositions.UNDER} // allowAccessibleLayout > {_.map([...Array(10)], (_item, index) => ( <Page style={{backgroundColor: BACKGROUND_COLORS[index]}} key={index}> <Text margin-15>CARD {index}</Text> </Page> ))} </Carousel> </View> </div> ); }
Result
Loading...
API
allowAccessibleLayout
Whether to layout Carousel for accessibility
boolean
animated
Should the container be animated (send the animation style via containerStyle)
boolean
animatedScrollOffset
Pass to attach to ScrollView's Animated.event in order to animated elements base on Carousel scroll offset (pass new Animated.ValueXY())
Animated.ValueXY