import * as React from 'react'; import { LayoutChangeEvent, NativeSyntheticEvent, NativeScrollEvent, StyleSheet, Text, View, ViewStyle } from 'react-native'; import Carousel, { Pagination } from 'react-native-snap-carousel'; class SnapCarouselTest extends React.Component { render(): React.ReactElement { return ( Item #1 ); } private onSnapToItem = (index: number) => { console.log("Snapped to: ", index); } private onScroll = (event: NativeSyntheticEvent) => { console.log("Scrolled: ", event); } private onLayout = (event: LayoutChangeEvent) => { console.log("Layout: ", event); } } class SnapCarouselWithPaginationTest extends React.Component<{}, {activeSlide: number}> { constructor(props: {}) { super(props); this.state = { activeSlide: 0 }; } render(): React.ReactElement { return ( this.setState({ activeSlide: index })} > Item #1 Item #2 ); } } const styles = StyleSheet.create({ container: { flex: 1 } as ViewStyle, item: { width: 75 } as ViewStyle, });