Peel

Peel is one of the 16 effects of dissolve, an animation library for React Native. Peels off from the corner like a sticker, then flies away. It runs with useDissolvePeel from dissolve-ui.

Usage

Peel (React Native)
import { GestureDetector } from 'react-native-gesture-handler';
import Animated from 'react-native-reanimated';
import { useDissolvePeel } from 'dissolve-ui';

const { ref, gesture, style } = useDissolvePeel({
  threshold: 0.4,
  grain: 3,
  duration: 700,
  onCommit: () => remove(sticker.id),
});

<GestureDetector gesture={gesture}>
  <Animated.View ref={ref} style={[styles.sticker, style]} />
</GestureDetector>

Options

OptionTypeDefaultDescription
thresholdnumber0.4useDissolvePeel: share of the view diagonal the corner must travel to commit.
velocitynumber900useDissolvePeel: release speed in pt/s that commits regardless of distance.
grainnumber3Grain size in points. Raised automatically past about 6000 grains per burst.
durationnumber700Full effect length in ms. useDissolvePeel: fly off after a commit. With dissolve() it is the whole peel.
hapticsbooleantrueA tick when the paper lifts, a light impact on commit.
onCommit() => voidnoneCalled once the sticker is gone.
onCancel() => voidnoneCalled when released early and the sticker is back in place.
presetVariantName'dust'Auto mode: dissolve({ preset: 'peel' }) peels from the bottom right corner.
direction'out' | 'in''out'Auto mode: 'in' sticks the sticker back on.

Best practices

  • Made for stickers, badges and coupons: anything that should feel like paper.
  • Prefer useDissolvePeel: the fold follows the finger from any corner or edge.
  • Keep the default threshold (0.4) so a short pull springs back.
  • Avoid it on views with a transparent background, the back of the sticker is a plain paper color.
  • Reduced motion is handled by the provider: the effect is skipped and the promise resolves at once, so keep your state update after the await.

Install

Install the package and its peers, then wrap the app once in <DissolveProvider>, above the navigator.

npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-haptics
app/_layout.tsx
import { Stack } from 'expo-router';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { DissolveProvider } from 'dissolve-ui';

export default function Layout() {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <DissolveProvider>
        <Stack />
      </DissolveProvider>
    </GestureHandlerRootView>
  );
}

Previous: Morph · Next: Melt · All effects

dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.