Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-linear-gradient

Package Overview
Dependencies
Maintainers
9
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-linear-gradient

A <LinearGradient> element for React Native

  • 2.8.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
322K
decreased by-18.69%
Maintainers
9
Weekly downloads
 
Created

What is react-native-linear-gradient?

The react-native-linear-gradient package allows you to create linear gradients in your React Native applications. It provides a simple and flexible way to add gradient backgrounds to your components, enhancing the visual appeal of your app.

What are react-native-linear-gradient's main functionalities?

Basic Linear Gradient

This feature allows you to create a basic linear gradient with multiple colors. The colors array specifies the gradient colors, and the style prop is used to position and style the gradient.

import LinearGradient from 'react-native-linear-gradient';
import { View, Text } from 'react-native';

const App = () => (
  <LinearGradient
    colors={['#4c669f', '#3b5998', '#192f6a']}
    style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
  >
    <Text style={{ color: 'white' }}>Basic Linear Gradient</Text>
  </LinearGradient>
);

Gradient with Custom Start and End Points

This feature allows you to customize the start and end points of the gradient. The start and end props take objects with x and y coordinates, giving you control over the gradient direction.

import LinearGradient from 'react-native-linear-gradient';
import { View, Text } from 'react-native';

const App = () => (
  <LinearGradient
    colors={['#ff7e5f', '#feb47b']}
    start={{ x: 0, y: 0 }}
    end={{ x: 1, y: 1 }}
    style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
  >
    <Text style={{ color: 'white' }}>Custom Start and End Points</Text>
  </LinearGradient>
);

Gradient with Locations

This feature allows you to specify the locations of the gradient colors. The locations array should have the same length as the colors array, and it defines where each color should be placed along the gradient.

import LinearGradient from 'react-native-linear-gradient';
import { View, Text } from 'react-native';

const App = () => (
  <LinearGradient
    colors={['#e96443', '#904e95']}
    locations={[0.3, 0.7]}
    style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
  >
    <Text style={{ color: 'white' }}>Gradient with Locations</Text>
  </LinearGradient>
);

Other packages similar to react-native-linear-gradient

FAQs

Package last updated on 06 Sep 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc