npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@encoresdk/react-native

v1.1.3

Published

Encore SDK for React Native - cross-platform mobile offers SDK for iOS and Android

Downloads

9

Readme

Encore React Native SDK

A cross-platform React Native SDK for integrating Encore offers into your mobile apps. This SDK provides the same functionality as the native Encore Swift SDK, with full support for both iOS and Android platforms.

Features

  • 🎯 Present offers to users with beautiful, native UI
  • 📊 Track entitlements (free trials, discounts, credits)
  • 🔄 Automatic state management and caching
  • 🎨 Customizable UI configuration
  • 📱 Native iOS (Swift Package) and Android (AAR) builds
  • ⚡ TypeScript support with full type definitions

Installation

React Native

# Using npm
npm install @encore-sdk/react-native

# Using yarn
yarn add @encore-sdk/react-native

iOS (CocoaPods)

Add to your Podfile:

pod 'encore-react-sdk', :path => '../node_modules/@encore-sdk/react-native'

Then run:

cd ios && pod install

Android

The package auto-links with React Native 0.60+. If you need manual linking:

// android/settings.gradle
include ':encore-react-sdk'
project(':encore-react-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/@encore-sdk/react-native/android')

// android/app/build.gradle
dependencies {
    implementation project(':encore-react-sdk')
}

Quick Start

1. Configure the SDK

import { EncoreProvider } from '@encore-sdk/react-native';

function App() {
  return (
    <EncoreProvider
      config={{
        apiKey: 'your-api-key',
        logLevel: 'debug', // Optional: 'none' | 'debug'
      }}
    >
      <YourApp />
    </EncoreProvider>
  );
}

2. Identify Users

import { useEncoreContext } from '@encore-sdk/react-native';

function ProfileScreen() {
  const { identify } = useEncoreContext();

  useEffect(() => {
    identify('user-123', {
      email: '[email protected]',
      firstName: 'John',
    });
  }, []);
}

3. Present Offers

import { useEncoreContext } from '@encore-sdk/react-native';

function SubscriptionScreen() {
  const { presentOffers } = useEncoreContext();

  const handleShowOffers = async () => {
    const result = await presentOffers();
    
    if (result?.type === 'granted') {
      console.log('User accepted offer:', result.entitlement);
      // Update UI or grant access
    } else {
      console.log('User declined:', result?.reason);
    }
  };

  return (
    <Button title="View Special Offers" onPress={handleShowOffers} />
  );
}

4. Check Entitlements

import { useIsActive } from '@encore-sdk/react-native';

function PremiumFeature() {
  const { isActive, isLoading } = useIsActive(
    { type: 'freeTrial' },
    'verified'
  );

  if (isLoading) return <LoadingSpinner />;
  
  if (isActive) {
    return <PremiumContent />;
  }

  return <UpgradePrompt />;
}

API Reference

EncoreProvider

The root provider component that configures the SDK.

<EncoreProvider
  config={{
    apiKey: string;
    uiConfiguration?: EncoreUIConfiguration;
    logLevel?: 'none' | 'debug';
  }}
>

useEncoreContext

Hook to access all Encore SDK functionality.

const {
  isConfigured,
  currentUserId,
  identify,
  setUserAttributes,
  reset,
  isActive,
  refreshEntitlements,
  presentOffers,
} = useEncoreContext();

useIsActive

Hook to check if an entitlement is active.

const { isActive, isLoading, refresh } = useIsActive(
  entitlement: Entitlement,
  scope?: EntitlementScope
);

Placement API

import { Encore } from '@encore-sdk/react-native';

// Using the placement API for specific flows
Encore.placement('cancellation_flow')
  .onGranted((entitlement) => {
    console.log('User accepted offer');
  })
  .onNotGranted((reason) => {
    console.log('User declined');
  });

UI Customization

const uiConfig: EncoreUIConfiguration = {
  titleText: 'Special Offer Just for You!',
  subtitleText: 'Claim your exclusive deal below',
  offerDescriptionText: 'Get 3 months premium access',
  creditClaimedTitleText: 'Credit claimed!',
  applyCreditsButtonText: 'Apply credits',
};

<EncoreProvider config={{ apiKey, uiConfiguration: uiConfig }}>

Building Native Packages

iOS Swift Package

npm run build:ios

This creates a Swift Package at dist/ios/EncoreSDK/.

Android AAR

npm run build:android

This creates an AAR file at dist/android/encore-react-sdk.aar.

Build All

npm run build:all

Types

interface Entitlement {
  type: 'freeTrial' | 'discount' | 'credit';
  value?: number;
  unit?: 'months' | 'days' | 'percent' | 'dollars';
}

type EntitlementScope = 'verified' | 'all';

interface EncoreAttributes {
  email?: string;
  firstName?: string;
  lastName?: string;
  // ... additional fields
  custom?: Record<string, string>;
}

type EncorePresentationResult = 
  | { type: 'granted'; entitlement: Entitlement }
  | { type: 'notGranted'; reason: NotGrantedReason };

Requirements

  • React Native 0.60+
  • iOS 14.0+
  • Android API 21+

Support

License

MIT License - see LICENSE file for details.