React Native Flat Swiper

Preview

Installation
Type in the following to the command line to install the module.
$ npm install --save react-native-flat-swiper
or
$ yarn add react-native-flat-swiper
Usage
Add an import
to the top of the file. At minimal, place array
data into the data
prop and render the pages using the renderItem
prop.
import FlatSwiper from 'react-native-flat-swiper';
import { View, Image, StyleSheet } from 'react-native';
import React, { useRef } from 'react';
const SomeComponent = () => {
const flatSwiperRef = useRef(null);
const onSwipeIndexChange = (index: number) => {
};
flatSwiperRef?.current?.scrollBy(1, false);
flatSwiperRef?.current?.scrollTo(yourCardIndex, false);
return (
<FlatSwiper
index={0}
loop={false}
ref={flatSwiperRef}
horizontal={false}
loadMinimal={true}
data={yourData[] || []}
enableAndroidViewPager={false}
onIndexChangeReached={(index) => onSwipeIndexChange(index)}
renderItem={({ item, index }) => {
//IMPORTANT: props name "item" is required
return (
<View key={index} style={styles.item}>
<Text>View {index}</Text>
</View>
);
}}
/>
);
};
const styles = StyleSheet.create({
item: { flex: 1}
})