How to use the react-native-linear-gradient/ function in react-native-linear-gradient

To help you get started, we’ve selected a few react-native-linear-gradient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github guns2410 / react-native-components / lib / View / index.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import { Platform } from 'react-native';
import { View as RNView, KeyboardAvoidingView } from 'react-native';
import { renderChildren } from '../helpers';
import { MergeTheme } from '../theme';

const LinearGradient = Platform.OS === 'ios' ?
  require('react-native-linear-gradient/index.ios').default :

export default class View extends React.PureComponent {

  constructor (props) {
    this.theme = MergeTheme(props.theme);

  componentWillReceiveProps (nextProps) {
    if (this.props.theme !== nextProps.theme) this.theme = MergeTheme(nextProps.theme)

  render () {
    let Component = RNView;
    if (this.props.keyboardaware) Component = KeyboardAvoidingView;


A <LinearGradient> element for React Native

Latest version published 9 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages