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.42
latest
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

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

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

Expo will automatically handle linking and compatibility.

Border Gradient Usage

Animated Gradient Button

import { GradientWrapper } from 'react-native-gradient-wrapper';

<GradientWrapper
  borderGradient={['rgba(0, 0, 255, 0.9)', 'rgba(186, 0, 146, 0.97)']} 
  borderRadius={30}
  stopBorderAfter={300000} // stop after 30 sec
  borderAngle={46.38} // instead of start and end X,Y you can use angle
  borderWidth={2}
  contentStyle={{
    height: 35,
    width: '100%',
    alignItems: 'center',
    alignContent: 'center',
    flex: 1,
    padding: 10,
  }}
  style={{ margin: 0 }}
  enableFeedback
  backgroundGradient={['rgb(155, 70, 0)', 'rgb(50, 0, 56)']}
  backgroundLocations={[0, 0.6, 1]}
  angle={90} // angle for background color
>
  <TouchableOpacity onPress={() => setSpeed(prev => Math.max(1000, prev - 500))}>
    <Text style={{ color: '#FFFFFF' }}>Animated Border Button</Text>
  </TouchableOpacity>
</GradientWrapper>

Animated Background Gradient

Background Color Usage

import { GradientWrapper } from 'react-native-gradient-wrapper';

    <GradientWrapper
      backgroundGradient={['#5A3F37', '#2C7744', '#5A3F37']}
      backgroundRotationSpeed={4000}
      animated={true} //color rotation
      style={styles.container}
      borderWidth={0}
      angle={46.36}
    //   backgroundLocations={[0,0.5, 1]}//for background location
      borderRadius={0}
    >
      <View style={styles.content}>
        <Text style={styles.title}>Animated Background Gradient</Text>
      </View>
    </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