JSPM

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

React Native confetti explosion and fall like iOS does.

Package Exports

  • react-native-confetti-cannon

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-confetti-cannon) 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-confetti-cannon

CircleCI https://img.shields.io/npm/v/react-native-confetti-cannon/latest?color=%23292C33&label=%20&logo=npm https://img.shields.io/badge/Platforms-iOS%20%7C%C2%A0Android%20%7C%20Web-blue https://img.shields.io/github/stars/vincentcatillon/react-native-confetti-cannon?style=social

Installation

npm install react-native-confetti-cannon
# or
yarn add react-native-confetti-cannon

Usage

import ConfettiCannon from 'react-native-confetti-cannon';

const MyComponent = () => (
  <ConfettiCannon count={200} origin={{x: -10, y: 0}} />
);

Props

Name Type Description Required Default
count number items count to display required
origin {x: number, y: number} animation position origin required
explosionSpeed number explosion duration (ms) from origin to top 350
fallSpeed number fall duration (ms) from top to bottom 3000
fadeOut boolean make the confettis disappear at the end false
colors string[] give your own colors to the confettis default colors
autoStart boolean give your own colors to the confettis true

Events

Name Returns Description Required Default
onAnimationStart Item[] callback triggered at animation start
onAnimationResume Item[] callback triggered at animation resume
onAnimationStop Item[] callback triggered at animation stop
onAnimationEnd Item[] callback triggered at animation end

Methods

Name Returns Description Required Default
start Item[] start the animation programmatically
resume Item[] resume the animation programmatically
stop Item[] stop the animation programmatically

Try yourself

Deep into the example folder and run:

npm install && npm start

And choose one of the following Expo commands:

  • i: open in iOS simulator
  • a: open in Android emulator
  • w: open in web browser

⚠️ Warning

It is strongly recommended to use 1.2.0 or higher to avoid this warning introduced in React-Native 0.62:

Animated: useNativeDriver was not specified. This is a required option and must be explicitly set to true or false