How to use the react-native-linear-gradient.propTypes 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 react-native-community / react-native-linear-gradient / Examples / AnimatedGradientTransition / src / AnimatedGradientTransition.js View on Github external
import React, {Component} from 'react';
import {PropTypes} from 'prop-types';
import {Animated, Easing} from 'react-native';
import _ from 'lodash';

import NativeLinearGradient from 'react-native-linear-gradient';

class LinearGradient extends Component {
  static propTypes = {
    ...NativeLinearGradient.propTypes,
  };

  // Generate back the colors array with all transformed props
  _generateColorsArray(props) {
    const propsKeys = Object.keys(props);
    const colorsArray = [];

    propsKeys.forEach(key => {
      if (
        key.indexOf('animatedColor') !== -1 &&
        props[key] &&
        typeof props[key] === 'string'
      ) {
        colorsArray.push(props[key]);
      }
    });
github react-native-community / react-native-linear-gradient / Examples / AnimatedGradientTransition / src / AnimatedGradientTransition.js View on Github external
const colorsArray = this._generateColorsArray(props);
    const nativeLinearProps = _.omit(props, Object.keys(colorsArray));

    return (
      
        {children}
      
    );
  }
}

Animated.LinearGradient = Animated.createAnimatedComponent(LinearGradient);

class AnimatedGradientTransition extends Component {
  static propTypes = {
    ...NativeLinearGradient.propTypes,
    animation: PropTypes.shape({
      toValue: PropTypes.number,
      duration: PropTypes.number,
      easing: PropTypes.func,
    }),
  };

  static defaultProps = {
    animation: {
      toValue: 1,
      duration: 500,
      easing: Easing.linear,
    },
  };

  constructor(props) {
github Skjutsgruppen / skjutsgruppen-reactnative / app / components / common / circle.js View on Github external
if (animatable && params.animatedValue) {
      top = params.animatedValue.interpolate({
        inputRange: [0, 1000],
        outputRange: [yOffset, -1000],
      });
    }
    return (
      
    );
  }
}


Circle.propTypes = {
  style: LinearGradient.propTypes.style,
  animatable: PropTypes.bool,
  navigation: PropTypes.shape(),
};

Circle.defaultProps = {
  style: {},
  animatable: false,
  navigation: null,
};

export default withNavigation(Circle);

react-native-linear-gradient

A <LinearGradient> element for React Native

MIT
Latest version published 9 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages