JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3253
  • Score
    100M100P100Q132791F
  • License MIT

⚛ A pure JavaScript, performant, typed shimmer component for Android and iOS.

Package Exports

  • react-native-gradient-shimmer
  • react-native-gradient-shimmer/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-gradient-shimmer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React-Native Gradient Shimmer

License MIT npm version npm downloads

⚛ A pure JavaScript, performant, typed shimmer component for Android and iOS.

It uses React Native Animated API for animation, and expo-linear-gradient or react-native-linear-gradient for the gradient effect.

Android iOS

Requirements

Install

Install dependency package

yarn add react-native-gradient-shimmer

Or

npm i -S react-native-gradient-shimmer

Basic usage

Render the GradientShimmer directly:

import LinearGradient from 'react-native-linear-gradient'; // or 'expo-linear-gradient'
import GradientShimmer from 'react-native-gradient-shimmer';

const App = () => {
   return (
      <SafeAreaView style={{flex: 1}}>
         <PdfRendererView
            LinearGradientComponent={LinearGradient}
            backgroundColor="red"
            highlightColor="blue"
            height={120}
            width={120}
            style={{
              borderRadius: 60,
              margin: 8,
            }}
         />
      </SafeAreaView>
   );
}

export default App;

Or create your own GradientShimmer instance with default props:

import LinearGradient from 'react-native-linear-gradient'; // or 'expo-linear-gradient'
import {createGradientShimmer} from 'react-native-gradient-shimmer';

const CustomGradientShimmer = createGradientShimmer({
  backgroundColor: 'red',
  highlightColor: 'blue',
  LinearGradientComponent: LinearGradient,
})

const App = () => {
   return (
      <SafeAreaView style={{flex: 1}}>
         <CustomGradientShimmer
            height={120}
            width={120}
            style={{
              borderRadius: 60,
              margin: 8,
            }}
         />
      </SafeAreaView>
   );
}

export default App;

GradientShimmer props

Name Value Default Description
LinearGradientComponent ComponentType Linear gradient component from expo-linear-gradient or react-native-linear-gradient
width number Component width in DPI
height number Component height in DPI
backgroundColor string 'rgb(255,255,255)' Background color in HEX or RGB
highlightColor string 'rgb(200,200,200)' Highlight color in HEX or RGB
scale number 20 Scale factor to customize the highlight size
duration number 1500 Duration of the animation in milliseconds
style ViewStyle Styles passed to the LinearGradient component

Contribute

New features, bug fixes and improvements are welcome! For questions and suggestions use the issues.

Become a Patron! Donate

Star History

Star History Chart

License

The MIT License (MIT)

Copyright (c) 2023 Douglas Nassif Roma Junior

See the full license file.