Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Old Architecture Codegen Fix

This patch fixes the codegen issue that occurs when using @stripe/stripe-react-native versions before 0.52 with React Native 0.74+ in the old architecture.

The Problem

When using React Native 0.74+ with the old architecture, you may encounter this error during pod install:

UnsupportedModulePropertyParserError: Module NativeStripeSdkModule: TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's. Property 'onConfirmHandlerCallback' refers to a 'TSTypeReference'.

This occurs because the React Native codegen in the old architecture doesn't support EventEmitter properties in TurboModule interfaces.

The Solution

If possible, update to version 0.52 or above of the Stripe React Native SDK. If you are unable to do so, use the old-arch-codegen-fix patch.

This patch converts all EventEmitter properties to callback function methods, making them compatible with the old architecture codegen.

How to Apply

Option 1: Manual patch command

cd node_modules/@stripe/stripe-react-native
patch -p0 < patches/old-arch-codegen-fix.patch

Option 2: Using patch-package (Recommended)

  1. Install patch-package as a dev dependency:

    npm install --save-dev patch-package
  2. Apply the patch manually first:

    cd node_modules/@stripe/stripe-react-native
    patch -p0 < ../../patches/old-arch-codegen-fix.patch
  3. Generate a patch-package patch:

    npx patch-package @stripe/stripe-react-native
  4. Add postinstall script to your package.json:

    {
      "scripts": {
        "postinstall": "patch-package"
      }
    }

This ensures the patch is automatically applied whenever you run npm install.