You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-native-gradient-wrapper

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-gradient-wrapper

A flexible React Native gradient wrapper component with animated border and background gradients.

1.0.2
Source
npmnpm
Version published
Weekly downloads
41
-93.31%
Maintainers
0
Weekly downloads
 
Created
Source

GradientWrapper for React Native

GradientWrapper is a flexible, animated wrapper component for React Native that adds background and border gradients with support for animations, angle directions, theming, and per-side customization. It’s designed to be beginner-friendly while still powerful enough for advanced use cases.

  • ✅ Custom background gradients
  • ✅ Animated gradient transitions (color morphing)
  • ✅ Rotating background or border gradients
  • Light/Dark/Auto theme-aware defaults
  • Angle-based direction control for gradients
  • Per-side border gradient customization
  • ✅ Touchable feedback (scale on press)
  • ✅ Optional gradient animation stop timers (stopBackgroundAfter, stopBorderAfter)

🔧 Installation

Install peer dependencies first:

npm install react-native-gradient-wrapper react-native-linear-gradient

Then copy the GradientWrapper.tsx file into your project.

If you're using Expo, install the linear gradient library with:

npx expo install react-native-gradient-wrapper react-native-linear-gradient

Expo will automatically handle linking and compatibility.

Usage

import GradientWrapper from './GradientWrapper';

<GradientWrapper
  backgroundGradient={["#ff7e5f", "#feb47b"]}
  borderGradient={["#6a11cb", "#2575fc"]}
  borderRadius={20}
  borderWidth={1} // don't forget to make this 0(zero) if you aren't using it
  backgroundRotation="clockwise"
  borderRotation="anticlockwise"
  animated
  stopBackgroundAfter={5000} // stop after 5s
  stopBorderAfter={3000}    // stop after 10s
  angle={45}
  backgroundRotationSpeed={9000} // background spins every 3 seconds
  borderRotationSpeed={8000}
>
  <Text style={{ color: '#fff' }}>Hello Gradient</Text>
</GradientWrapper>

Props Reference

PropTypeDescription
backgroundGradientstring[]Background color array
borderGradientstring[]Border color array (fallback if no sides defined)
borderTopGradientstring[]Top border only
borderBottomGradientstring[]Bottom border only
borderLeftGradientstring[]Left border only
borderRightGradientstring[]Right border only
borderWidthnumberWidth of the border (default 2)
borderRadiusnumberCorner radius (default 10)
backgroundRotation'clockwise' | 'anticlockwise' | 'none'Rotating background effect
borderRotation'clockwise' | 'anticlockwise' | 'none'Rotating border effect
backgroundRotationSpeednumberMilliseconds for one background rotation cycle
borderRotationSpeednumberMilliseconds for one border rotation cycle
stopBackgroundAfternumberStops background animation after X ms
stopBorderAfternumberStops border animation after X ms
animatedbooleanAnimate colors across gradient stops
anglenumberDirection in degrees (e.g. 45) for background
borderAnglenumberDirection in degrees for border gradient
theme'light' | 'dark' | 'auto'Theme-based fallback gradient colors
onPress, onLongPress() => voidPress handlers
enableFeedbackbooleanScale animation on press (default true)

Comparison with Other Libraries

Feature / Libraryreact-native-gradient-wrapperreact-native-linear-gradientreact-native-gradientsreact-native-animated-linear-gradient
✅ Background gradient support
✅ Border gradient
✅ Animated color transition (morph)✅ (only background)
✅ Rotation animation support
✅ Per-side border control
✅ Theme-aware fallback colors
✅ Pressable feedback (scale)
✅ Angle-based gradient direction
✅ Stop animations after delay

Note: GradientWrapper internally uses react-native-linear-gradient and extends it with a complete system of wrappers, animations, fallback themes, and UI feedback.

Ideal Use Cases

  • Buttons with animated borders
  • Cards with glowing outlines
  • Containers with gradient backgrounds
  • Interactive boxes with animated themes
  • Light/Dark mode responsive UI blocks

Future Plans

  • Support for Lottie-like morphing gradients
  • Web support (React Native Web)
  • Built-in presets (e.g. fire, neon, galaxy)

Props

Check src/index.tsx for all available props and defaults.

License

MIT

Keywords

react-native

FAQs

Package last updated on 27 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts