react-native-share

Native share sheets and direct social-app sharing for React Native, from a single cross-platform API.

Library
npm
v12.3.1
3,894stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
84/100Excellent
Development Activity76
Maintenance76
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
66/100Good
Architecture72
Code Quality45
Innovation78
Learning Curve68

react-native-share wraps the native iOS UIActivityViewController and Android Intent/ACTION_SEND sharing pipelines behind a single JavaScript API, letting React Native apps share text, URLs, images, videos, and files without writing separate native code for each platform. Beyond the generic OS share sheet, it exposes shareSingle for targeting a specific destination directly — Facebook, Instagram (including Stories), WhatsApp, Twitter, Telegram, LinkedIn, Pinterest, Snapchat, Discord, Viber, SMS, and email — bypassing the share sheet entirely when the calling app already knows exactly where content should go.

The library ships prebuilt Overlay, Sheet, and ShareSheet React components for building custom in-app share pickers, plus an Expo config plugin that wires up the iOS LSApplicationQueriesSchemes and Android <queries> manifest entries automatically for managed workflow projects. A New Architecture-ready TurboModule spec (NativeRNShare) sits underneath the JS API, keeping the library compatible with both the legacy bridge and Fabric/TurboModules, with Windows also supported as a third native platform target.

What You Get

  • A single Share.open() call that triggers the native OS share sheet on both iOS and Android, accepting text, URLs, single or multiple files, and base64 assets.
  • Share.shareSingle() for direct, one-tap sharing to a named destination (Facebook, Instagram Stories, WhatsApp, Twitter, Telegram, LinkedIn, Pinterest, Snapchat, Discord, Viber, SMS, or email) without showing the share sheet.
  • Prebuilt Overlay, Sheet, Button, and ShareSheet React components for building a custom in-app share picker UI.
  • An Expo config plugin (app.plugin.js) that automatically configures iOS LSApplicationQueriesSchemes and Android <queries> manifest entries for managed workflow projects.
  • An isPackageInstalled() helper (Android) to check whether a target social app is installed before attempting to share to it.

Common Use Cases

  • Referral and invite flows - an app shares a referral link or invite message directly to WhatsApp or SMS to drive viral growth loops.
  • Social growth features - a content or media app lets users post a photo or video directly to Instagram Stories or Facebook Stories with a background image and sticker.
  • Content export - a document, note, or photo-editing app exports a generated file (PDF, image, video) through the native share sheet to any installed destination app.
  • Custom share sheets - an app replaces the default OS share sheet with its own branded picker built from the library’s Overlay/Sheet/ShareSheet components, then routes the selection through shareSingle.

Under The Hood

Architecture The core module dispatches by a Social enum to a dedicated per-network implementation on each platform: src/index.tsx normalizes options (helpers/options.ts handles backward-compatible urlurls shaping) and calls into a codegen’d TurboModule spec (src/codegenSpec/NativeRNShare.ts), which is backed by RNShareImpl.java on Android — an ActivityEventListener that delegates to a family of per-app classes under cl.json.social (WhatsAppShare, TelegramShare, InstagramStoriesShare, etc.) — and by RNShare.mm on iOS, which similarly delegates to per-network Objective-C classes (WhatsAppShare.m, InstagramShare.m, DiscordShare.m). This is a clean strategy-pattern-per-social-network design that isolates the open/shareSingle bridge contract from individual network quirks, but it means adding a new social target touches three places in parallel (the JS Social enum, an Android class, and an iOS class pair) — a structural duplication cost visible across the platform parity surface.

Tech Stack A React Native native module supporting both the legacy bridge and the New Architecture (a codegenConfig entry and RCT_NEW_ARCH_ENABLED conditional compilation in RNShare.mm), written in TypeScript on the JS side, Java on Android, and Objective-C(++) on iOS, with a third native implementation under windows/ for react-native-windows. Built and packaged via react-native-builder-bob into commonjs/module/typescript outputs, linted with @react-native/eslint-config and Prettier, gated by husky pre-commit hooks plus commitlint, and released automatically through semantic-release. An Expo config plugin built on @expo/config-plugins extends support to managed-workflow projects with no native code edits required.

Code Quality No automated test suite exists in the repository — no __tests__ directories or .test. files were found anywhere in src/, android/, or ios/. Correctness is enforced only through tsc --noEmit type-checking and ESLint (yarn validate runs both) in CI, alongside a CodeQL security-scanning workflow. TypeScript types in src/types.ts are precise, using discriminated unions to distinguish InstagramStoriesShareSingleOptions and FacebookStoriesShareSingleOptions from the base share options, and helper functions (helpers/options.ts, helpers/checkPermissions.ts) are small and single-purpose. The complete absence of tests is a real gap for a library this widely depended upon.

API Design The public surface is deliberately small: Share.open() and Share.shareSingle() cover almost every use case, with sensible defaults (failOnCancel defaults to true) and automatic backward-compatible option normalization so older { url }-style calls keep working. Discriminated-union types make Stories-specific fields (background image, sticker, colors) type-safe at the call site rather than requiring documentation lookups, and the bundled Overlay/Sheet/ShareSheet components let consumers skip building their own picker UI entirely. The Expo config plugin removes essentially all manual native configuration for managed-workflow apps, and a dedicated documentation site (website/docs, 10+ guide pages) plus a full example app under example/ keep the onboarding path short despite the library’s broad native surface.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search