A high-performance confetti component for React Native, powered by Reanimated 4. Inspired by canvas-confetti, fully compatible with Expo.
- π High Performance - Built with Reanimated 4 for smooth 60fps animations on UI thread
- π± Expo Compatible - Works seamlessly with Expo managed workflow
- π¨ Fully Customizable - Control colors, shapes, physics, and more
- π Multiple Shapes - Supports squares, circles, and stars
- π― Preset Effects - Ready-to-use effects like fireworks, stars, and realistic confetti
- π Canvas Confetti API - Familiar API inspired by canvas-confetti
- π¦ TypeScript - Full TypeScript support
- π§ Lightweight - Minimal dependencies
npm install react-native-confetti-reanimated react-native-reanimatedOr with Expo:
npx expo install react-native-confetti-reanimated react-native-reanimatedAdd the Babel plugin to your babel.config.js:
For Expo projects (SDK 50+):
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
// Reanimated plugin is automatically included in Expo SDK 50+
};
};For React Native CLI projects:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
'react-native-worklets/plugin',
'react-native-reanimated/plugin',
],
};
β οΈ Important: For Expo, plugins are auto-included. For React Native CLI, add both plugins (worklets before reanimated). Restart your app after changes.
import React from 'react';
import { View, Button } from 'react-native';
import { ConfettiCanvas, useConfetti } from 'react-native-confetti-reanimated';
export default function App() {
const { confettiRef, fire } = useConfetti();
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button title="π Celebrate!" onPress={() => fire()} />
<ConfettiCanvas ref={confettiRef} />
</View>
);
}import { presets } from 'react-native-confetti-reanimated';
// Basic cannon burst
fire(presets.basicCannon);
// Random direction (different each time)
fire(presets.randomDirection);
// Realistic confetti (mixed bursts)
fire(presets.realistic);
// Fireworks effect (continuous from sides)
fire(presets.fireworks);
// Stars burst
fire(presets.stars);fire({
particleCount: 100,
spread: 70,
origin: { y: 0.6 },
colors: ['#ff0000', '#00ff00', '#0000ff'],
shapes: ['square', 'circle', 'triangle'],
startVelocity: 45,
gravity: 1,
decay: 0.9,
});// Left cannon
fire(presets.leftCannon);
// Right cannon
fire(presets.rightCannon);
// Bottom cannon (shoot upward)
fire(presets.bottomCannon);const startContinuous = () => {
const interval = setInterval(() => {
fire({ particleCount: 10 });
}, 200);
// Stop after 3 seconds
setTimeout(() => clearInterval(interval), 3000);
};Main component that renders confetti particles.
Props:
| Prop | Type | Default | Description |
|---|---|---|---|
containerStyle |
StyleProp<ViewStyle> |
undefined |
Custom style for container |
zIndex |
number |
1000 |
Z-index of confetti layer |
fullScreen |
boolean |
true |
Whether to cover full screen |
Hook for controlling confetti.
Returns:
confettiRef- Ref to pass to ConfettiCanvasfire(config?)- Function to trigger confettireset()- Clear all confetti
interface ConfettiConfig {
particleCount?: number; // Default: 50
angle?: number; // Default: 90 (degrees)
spread?: number; // Default: 45 (degrees)
startVelocity?: number; // Default: 45
decay?: number; // Default: 0.9
gravity?: number; // Default: 1
drift?: number; // Default: 0
duration?: number; // Default: 3000 (ms)
colors?: string[]; // Default: vibrant colors
scalar?: number; // Default: 1
origin?: { x?: number; y?: number }; // Default: { x: 0.5, y: 0.5 }
shapes?: Array<'square' | 'circle' | 'star'>; // Default: ['square']
tilt?: boolean; // Default: true
tiltAngleIncrement?: number; // Default: 10
}presets.basicCannon // π Basic celebration burst
presets.randomDirection // π² Random direction & amount
presets.realistic // β¨ Realistic confetti (mixed bursts)
presets.fireworks // π Continuous fireworks from sides
presets.stars // β Golden star burst
presets.leftCannon // β¬
οΈ Left side cannon
presets.rightCannon // β‘οΈ Right side cannon
presets.bottomCannon // β¬οΈ Bottom cannonCheck out the example directory for a complete demo app with all features:
- π Basic Cannon
- π² Random Direction
- β¨ Realistic Look
- π Fireworks
- β Stars
cd example
npm install
npm startThen use Expo Go to scan the QR code or press i for iOS / a for Android.
- β iOS
- β Android
- β Expo (SDK 50+, tested with SDK 54)
- React β₯ 18.0.0 (tested with React 19)
- React Native β₯ 0.74 (New Architecture/Fabric required)
- React Native Reanimated β₯ 4.0.0
- Expo SDK β₯ 50 (tested with SDK 54)
Note: Reanimated 4 requires React Native's New Architecture (Fabric). Expo SDK 50+ has this enabled by default.
- Ensure
ConfettiCanvasis in your component tree - Verify Babel plugin is configured (
react-native-worklets/plugin) - Restart your app completely after Babel changes
- Clear Metro cache:
npx react-native start --reset-cache - Make sure you're using React Native New Architecture (Fabric)
- Reduce
particleCount(recommended: 50-100) - Shorten
duration(recommended: 2-3 seconds) - Ensure you're using the latest version of Reanimated
npm install --save-dev @types/react @types/react-nativeContributions are welcome! Please see CONTRIBUTING.md.
MIT Β© Andy A
- Inspired by canvas-confetti by @catdad
- Built with react-native-reanimated v4
- Uses react-native-worklets
- π¦ npm
- π Issues
- π¬ Discussions
Made with β€οΈ and confetti