npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-image-shadow

v0.1.4

Published

A React Native library that generates beautiful shadows from images using color analysis and gradient effects.

Readme

react-native-image-shadow

npm version MIT License React Native

A React Native library that generates beautiful shadows from images using color analysis and gradient effects. Automatically extracts dominant colors from images and creates dynamic gradient backgrounds that complement the image content.

✨ Features

  • 🎨 Automatic Color Extraction - Extracts dominant colors from images using advanced palette analysis
  • 🌈 Dynamic Gradients - Creates beautiful gradient backgrounds based on image content
  • 🌀 Multiple Gradient Angles - 6 different gradient directions for variety
  • 🧩 Easy Integration - Simple API that works with existing React Native components
  • Performance Optimized - Lightweight and efficient with proper memoization
  • 🛡️ Error Handling - Graceful fallbacks for failed image loads or color extraction
  • 📱 Cross Platform - Works on both iOS and Android

📦 Installation

Prerequisites

Make sure you have the following dependencies installed in your React Native project:

npm install react-native-linear-gradient @somesoap/react-native-image-palette
# or
yarn add react-native-linear-gradient @somesoap/react-native-image-palette

Install the library

npm install react-native-image-shadow
# or
yarn add react-native-image-shadow

iOS Setup

For iOS, you'll need to install CocoaPods dependencies:

cd ios && pod install && cd ..

🚀 Quick Start

import React from 'react';
import { SafeAreaView, StyleSheet } from 'react-native';
import ImageCard from 'react-native-image-shadow';

export default function App() {
  return (
    <SafeAreaView style={styles.container}>
      <ImageCard
        item={{
          url: 'https://images.unsplash.com/photo-1506744038136-46273834b3fb',
        }}
        style={{ width: 200, height: 200 }}
        gradientAngleIndex={1}
      />
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#fff',
  },
});

📖 API Reference

Props

| Prop | Type | Required | Default | Description | | -------------------- | ------ | -------- | ------- | ------------------------------------ | | item | object | ✅ | - | Object containing the image URL | | item.url | string | ✅ | - | URL or require() path to the image | | style | object | ❌ | - | Custom styles for the container | | gradientAngleIndex | number | ❌ | auto | Index to select gradient angle (0-5) |

Gradient Angles

The library provides 6 different gradient angles that you can select using gradientAngleIndex:

  • 0: Diagonal from bottom-left to top-right
  • 1: Diagonal from top-left to bottom-right
  • 2: Diagonal from top-right to bottom-left
  • 3: Vertical from top to bottom
  • 4: Diagonal from bottom-right to top-left
  • 5: Diagonal from top-right to bottom-left (alternative)

If no gradientAngleIndex is provided, the library automatically selects an angle based on the image URL hash.

💡 Usage Examples

Basic Usage

import ImageCard from 'react-native-image-shadow';

<ImageCard
  item={{
    url: 'https://example.com/image.jpg',
  }}
/>;

Custom Styling

<ImageCard
  item={{
    url: 'https://example.com/image.jpg',
  }}
  style={{
    width: 300,
    height: 200,
    borderRadius: 25,
    margin: 20,
  }}
/>

Specific Gradient Angle

<ImageCard
  item={{
    url: 'https://example.com/image.jpg',
  }}
  gradientAngleIndex={2}
  style={{ width: 150, height: 150 }}
/>

Multiple Cards with Different Angles

import React from 'react';
import { FlatList, View } from 'react-native';
import ImageCard from 'react-native-image-shadow';

const images = [
  { id: '1', url: 'https://example.com/image1.jpg' },
  { id: '2', url: 'https://example.com/image2.jpg' },
  { id: '3', url: 'https://example.com/image3.jpg' },
];

export default function ImageGallery() {
  const renderImageCard = ({ item, index }) => (
    <ImageCard
      item={item}
      gradientAngleIndex={index % 6}
      style={{ width: 120, height: 120, margin: 10 }}
    />
  );

  return (
    <FlatList
      data={images}
      renderItem={renderImageCard}
      keyExtractor={item => item.id}
      horizontal
    />
  );
}

Local Images

<ImageCard
  item={{
    url: require('./assets/local-image.png'),
  }}
  style={{ width: 200, height: 200 }}
/>

🎨 How It Works

  1. Image Analysis: The library uses @somesoap/react-native-image-palette to extract dominant colors from the image
  2. Color Selection: It intelligently selects primary and background colors from the palette
  3. Gradient Creation: Creates a beautiful gradient using the extracted colors
  4. Fallback Handling: If color extraction fails, it uses default colors and fallback images

🔧 Customization

Default Colors

The library uses a modern teal blue (#36D1C4) as the default color when color extraction fails.

Available Gradient Angles

You can access the available gradient angles programmatically:

import ImageCard from 'react-native-image-shadow';

console.log(ImageCard.GRADIENT_ANGLES);
// Returns array of gradient angle configurations

📱 Example App

Check out the example app in the example/LatestApp directory to see the library in action:

cd example/LatestApp
npm install
# or
yarn install

# For iOS
npx react-native run-ios

# For Android
npx react-native run-android

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments


Made with ❤️ by Ashraz Rashid