0.1.15 • Published 1 year ago

react-native-easy-swiper v0.1.15

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Native Easy Swiper 🚀

React Native Easy Swiper - is a versatile library that simplifies the implementation of swipeable views in React Native. With minimal setup, you can easily create swipeable images and components.

Table of Contents

Installation

To install, you can use npm or yarn:

npm install react-native-easy-swiper

or

yarn add react-native-easy-swiper

Demo

React Native Easy Swiper Demo 1     React Native Easy Swiper Demo 2     React Native Easy Swiper Demo 3 Try on snack

Core Features

  • Direction - Supports horizontal and vertical swiping direction
  • Animations - Supports fade and scale animation
  • Pagination - Provides three types of animated pagination styles with lots of customization

Basic Usage

import * as React from 'react';
import Swiper from "react-native-easy-swiper"
const images = [
  "https://www.beatsbydre.com/content/dam/beats/web/product/headphones/solo3-wireless/pdp/product-carousel/black/pc-solo3-black-thrqtr-left.jpg",
  "https://www.beatsbydre.com/content/dam/beats/web/product/headphones/solo3-wireless/pdp/product-carousel/black/pc-solo3-black-thrqtr-right.jpg",
  "https://www.beatsbydre.com/content/dam/beats/web/product/headphones/solo3-wireless/pdp/product-carousel/black/pc-solo3-black-folded.jpg",
];
export default function App() {
  return <Swiper images={images} />
}

Advance Usage

import * as React from 'react';
import { View, Image, StyleSheet } from 'react-native';
import Swiper from 'react-native-easy-swiper';
const images = [
  'https://images.unsplash.com/photo-1542291026-7eec264c27ff?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80',
  'https://images.unsplash.com/photo-1606107557195-0e29a4b5b4aa?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=764&q=80',
  'https://images.unsplash.com/photo-1608231387042-66d1773070a5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1374&q=80',
];
export default function App() {
  return (
    <View style={styles.container}>
      <Swiper
        height={400}
        dotBorderStyle={{
          borderColor: 'white',
        }}
        dotColor='white'
      >
        {images.map((image, index) => (
          <Image
            key={index}
            source={{ uri: image }}
            style={
              {
                width: "100%",
                height: "100%",
                resizeMode: "cover"
              }} />
        ))}
      </Swiper>
    </View>
  );
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#000',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});

Api Documentation

Core Props

PropertyTypesDefaultsDescription
imagesarraynullArray of strings, each of which represents a URL for an image
imagesStylesImageStyle{}Styles for images
childrenReactNodenullEither pass images or children*
horizontalbooleantrueSwiper direction for vertical swiper pass horizontal={false}
animationsarray[]Can pass multiple animations scale fade

Container Props

PropertyTypesDefaultsDescription
fullScreenbooleanfalseTakes full screen width and height
heightnumberscreenHeightHeight of container
widthnumberscreenWidthWidth of container
containerStyleViewStyle{}Other styles for container

Pagination Props

PropertyTypesDefaultsDescription
hideDotbooleanfalseHides pagination
dotTypedot border dasheddashedPagination style
dotColorstringlightgrayDot color
dotPositionleft right top bottomhorizontal ? bottom : leftPostion of dot around container
dotStyleViewStylenullStyles for dots
dotMarginnumber20Distance from container depending on dotPosition
dotSpacingnumber8Gap between dots
activeDotColorstringblackActive dot color
dotBorderStyleViewStyle{}Default borderWidth: 1 and borderColor: "#1d1d1d" for dotType: "border"
activeDashSizenumber32Length of dash for dotType: "dashed"

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.1.15

1 year ago

0.1.14

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago