React Native Image Slider Component

A lightweight, customizable slider with zero dependencies

✨ Zero Dependencies 📱 iOS & Android 🎨 Fully Customizable ⚡ Lightweight 🔧 TypeScript

Features

Everything you need in an image slider

Zero Dependencies

No external packages required. Smaller bundle size, faster installation, and better security.

🎨

Fully Customizable

Bring your own icons from any library. Customize colors, sizes, and styles to match your design.

📱

Cross-Platform

Works on iOS, Android, Expo, Windows, macOS, tvOS, and visionOS.

Performance

Built with FlatList for optimal performance and smooth scrolling.

🔧

TypeScript Support

Full TypeScript definitions included for better developer experience.

🖼️

Loading States

Built-in loading indicators and placeholder support.

🔄

Auto Play & Loop

Optional auto-play with customizable intervals and infinite loop support.

⚙️

Dot Indicators

Customizable dot indicators with color and size options.

Interactive Demo

Try it out with live controls

Image Slider Demo

Installation

Get started in seconds

npm install react-native-image-slider-component

or

yarn add react-native-image-slider-component

Usage Examples

Simple and powerful

import React, { useState } from 'react';
import { ImageSlider } from 'react-native-image-slider-component';

const App = () => {
  const [currentIndex, setCurrentIndex] = useState(0);
  
  const images = [
    { uri: 'https://picsum.photos/seed/a/600/400' },
    { uri: 'https://picsum.photos/seed/b/600/400' },
    { uri: 'https://picsum.photos/seed/c/600/400' },
  ];

  return (
    <ImageSlider
      images={images}
      currentIndex={currentIndex}
      onIndexChange={setCurrentIndex}
      height={300}
    />
  );
};
import { ChevronLeft, ChevronRight } from 'lucide-react-native';

<ImageSlider
  images={images}
  currentIndex={currentIndex}
  onIndexChange={setCurrentIndex}
  leftArrowComponent={<ChevronLeft size={30} color="#fff" />}
  rightArrowComponent={<ChevronRight size={30} color="#fff" />}
  arrowContainerStyle={{
    backgroundColor: 'rgba(0, 0, 0, 0.6)',
    borderRadius: 25,
    padding: 12,
  }}
/>
<ImageSlider
  images={images}
  currentIndex={currentIndex}
  onIndexChange={setCurrentIndex}
  autoPlay={true}
  autoPlayInterval={5000}
  loop={true}
  height={300}
/>
<ImageSlider
  images={images}
  currentIndex={currentIndex}
  onIndexChange={setCurrentIndex}
  showDots={true}
  dotColor="rgba(255,255,255,0.5)"
  activeDotColor="#ff6b6b"
  dotSize={10}
  height={300}
/>

Props

Complete API reference

Prop Type Default Description
images { uri: string }[] required Array of images to display
height number 220 Height of the slider
currentIndex number 0 Current visible image index
onIndexChange (index: number) => void () => {} Callback when index changes
showNavigationArrows boolean true Show/hide navigation arrows
showPlaceholder boolean true Show loading placeholder
placeholderBackgroundColor string '#e0e0e0' Background color while loading
loaderColor string '#007AFF' Color of loading indicator
leftArrowComponent React.ReactNode Default chevron Custom left arrow component
rightArrowComponent React.ReactNode Default chevron Custom right arrow component
arrowContainerStyle ViewStyle Default style Custom style for arrow containers
showDots boolean true Show/hide dot indicators
dotColor string '#ccc' Color of inactive dots
activeDotColor string '#007AFF' Color of active dot
dotSize number 8 Size of dots in pixels
autoPlay boolean false Enable auto play
autoPlayInterval number 3000 Time between slides (ms)
loop boolean false Enable infinite loop
imageResizeMode 'cover' | 'contain' | 'stretch' | 'center' 'cover' How images should fit
onImagePress () => void undefined Callback when image is pressed