Skip to content

[INTER-970] Add support for new arch - #261

Open
TheUnderScorer wants to merge 33 commits into
mainfrom
feature/INTER-970-new-arch
Open

[INTER-970] Add support for new arch#261
TheUnderScorer wants to merge 33 commits into
mainfrom
feature/INTER-970-new-arch

Conversation

@TheUnderScorer

@TheUnderScorer TheUnderScorer commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Migrate native modules to the New Architecture (New Architecture only)

Migrates the Android & iOS native modules from the legacy bridge to TurboModules and drops
Old Architecture support entirely. The SDK now targets the New Architecture only.

Warning

Breaking change. The SDK now requires React Native >= 0.79 (Expo SDK >= 53) to ensure compatibility with upcoming support for API v4. The New Architecture is required. Consumers on the Old Architecture or RN < 0.79 must upgrade. Released as a major version bump.

JS / TypeScript

  • Add Codegen TurboModule spec src/specs/NativeRNFingerprintjsPro.ts and codegenConfig in
    package.json.
  • Access the module via TurboModuleRegistry.getEnforcing, replacing the hand-written
    react-native.d.ts augmentation.
  • Change getVisitorData's native return from a tuple to an object
    ({ requestId, confidenceScore, visitorDataJson, sealedResult }), since Codegen can't express
    tuples. Internal only; the public VisitorData type is unchanged.

Android

  • Module extends the Codegen-generated NativeRNFingerprintjsProSpec directly
  • Single RNFingerprintjsProPackage using BaseReactPackage + ReactModuleInfoProvider (TurboModule
    registration).
  • build.gradle unconditionally applies the React Gradle plugin (runs library Codegen) and always
    adds the generated Codegen source dir.

iOS

  • RNFingerprintjsPro.m.mm, with the TurboModule glue (spec conformance + getTurboModule:
    backed by the generated JSI) always compiled.
    RCT_EXTERN_MODULE / RCT_EXTERN_METHOD are kept (module registration / method export).
  • Align the Swift @objc selectors/params to the generated spec.
  • podspec: add install_modules_dependencies(s); exclude ios/build/** from source_files.

Native method signature cleanup

Internal ergonomics of the RNFingerprintjsPro module. No public API change.

  • configure: reorder so required params come first and the only genuinely-optional ones
    (region, endpointUrl) come last. The rest always carry SDK-side defaults, so they stay required.
  • Remove getVisitorIdWithTimeout / getVisitorDataWithTimeout; getVisitorId / getVisitorData
    now take a trailing nullable timeout: Double | null (null = no timeout, 0 still valid). With
    Old Architecture gone, the timeout is a genuine nullable — Codegen maps Double | null to Android
    @Nullable Double / iOS NSNumber * — so the previous negative-value sentinel is dropped.

Tooling, CI & docs

  • e2e-app: prune the RN version-compat scaffolding to the 0.79 floor. Remove the 0.73–0.77
    entries from compatibility.mjs and reactNativeMetadata.ts, delete app-config-tools/arch.ts,
    expoConfigPatchers.ts, and plugins/withAndroidMavenRepo.js (the Expo 50 Maven-repo workaround),
    and drop setCompileSdkVersion / stripAndroidExtraBuildProperties. app.config.ts now hardcodes
    newArchEnabled = true.
  • CI (.github/workflows/e2e-tests.yml): reduce the matrix to
    `['local', '0.79', '0.81', '0.83', '0.85'].
  • Docs: README.md / sdk/README.md state RN 0.79+ (New Architecture only) / Expo 53+.
  • Add a major Changeset.

Validation

  • SDK: pnpm build + pnpm test (72 passed) + pnpm lint + pnpm test:dts are green.
  • iOS/Android: app builds, installs, and launches on the New Architecture (via the e2e matrix).
  • E2E tests green.

@TheUnderScorer TheUnderScorer self-assigned this Jul 24, 2026
@TheUnderScorer
TheUnderScorer changed the base branch from chore/INTER-2077-care to chore/INTER-2077-remove-test-project July 24, 2026 10:02
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Coverage report

St.
Category Percentage Covered / Total
🔴 Statements
51.67% (-0.71% 🔻)
139/269
🟡 Branches
61.96% (+2.65% 🔼)
114/184
🔴 Functions 47.37% 27/57
🔴 Lines
50% (-0.76% 🔻)
130/260
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / NativeRNFingerprintjsPro.ts
100% 100% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡 FingerprintJsProAgent.ts
73.91% (-3.86% 🔻)
87.1% (+8.15% 🔼)
100%
73.91% (-3.86% 🔻)

Test suite run success

72 tests passing in 4 suites.

Report generated by 🧪jest coverage report action from 62e7bc6

Show full coverage report
St File % Stmts % Branch % Funcs % Lines Uncovered Line #s
🟡 All files 51.67 61.95 47.36 50
🟡  src 51.67 61.95 47.36 50
🟡   FingerprintJsProAgent.ts 73.91 87.09 100 73.91 44,60-63,96,104
🔴   FingerprintJsProAgent.web.ts 0 0 0 0 7-109
🟡   FingerprintJsProContext.ts 75 100 0 75 5
🟢   FingerprintJsProProvider.tsx 100 100 100 100
🔴   errors.ts 10.71 100 10.71 10.71 8-33,56-249,272-285,308-333
🔴   index.ts 0 0 0 0
🔴   types.ts 0 0 0 0
🔴   unwrapError.ts 21.87 9.67 100 21.87 43-47,54-96,100
🔴   unwrapError.web.ts 0 0 0 0 33-99
🟢   useVisitorData.ts 100 100 100 100
🟢   utils.ts 100 100 100 100
🔴  src/specs 0 0 0 0
🔴   NativeRNFingerprintjsPro.ts 0 0 0 0

@TheUnderScorer
TheUnderScorer force-pushed the feature/INTER-970-new-arch branch 4 times, most recently from cd82e2f to e38aa15 Compare August 3, 2026 11:56
@TheUnderScorer
TheUnderScorer force-pushed the feature/INTER-970-new-arch branch 4 times, most recently from 380c356 to 7b7f0f7 Compare August 3, 2026 13:12
@TheUnderScorer
TheUnderScorer requested a review from Copilot August 3, 2026 13:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the library’s native modules to React Native’s New Architecture (TurboModules + Codegen) while keeping legacy-bridge compatibility, and adjusts JS/native contracts, packaging, and CI/E2E validation accordingly.

Changes:

  • Introduces a Codegen TurboModule spec and switches JS access to TurboModuleRegistry.getEnforcing, updating native return shapes (tuple → object) and aligning iOS/Android native signatures.
  • Splits Android sources into old-arch vs new-arch source sets and conditionally wires Codegen sources when newArchEnabled is set by the consuming app.
  • Updates tests and E2E/CI tooling (arch info UI, retry wrapper for Detox commands).

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/src/types.ts Removes legacy tuple type used for native visitor data.
sdk/src/specs/NativeRNFingerprintjsPro.ts Adds TurboModule Codegen spec + NativeVisitorData object contract.
sdk/src/react-native.d.ts (deleted) Removes handwritten NativeModules type augmentation in favor of Codegen spec usage.
sdk/src/FingerprintJsProAgent.ts Switches JS module access to TurboModule registry and updates parsing for object-shaped visitor data.
sdk/RNFingerprintjsPro.podspec Excludes iOS build artifacts and installs TurboModule dependencies for New Arch builds.
sdk/package.json Adds codegenConfig and includes src/specs in published files.
sdk/ios/RNFingerprintjsPro.xcodeproj/project.pbxproj Renames Obj-C bridge file to .mm for Obj-C++ compilation under New Arch.
sdk/ios/RNFingerprintjsPro.swift Aligns Swift selectors/params with generated spec and returns object-shaped visitor data.
sdk/ios/RNFingerprintjsPro.mm Adds New Arch TurboModule conformance + JSI-backed getTurboModule: implementation.
sdk/ios/RNFingerprintjsPro.m (deleted) Removes legacy Obj-C bridge file replaced by .mm.
sdk/android/src/oldarch/java/com/fingerprintjs/reactnative/RNFingerprintjsProSpec.kt Adds old-arch base spec to mirror Codegen surface area.
sdk/android/src/oldarch/java/com/fingerprintjs/reactnative/RNFingerprintjsProPackage.kt Keeps legacy ReactPackage registration for old RN versions.
sdk/android/src/newarch/java/com/fingerprintjs/reactnative/RNFingerprintjsProSpec.kt Adds new-arch base spec extending the generated Codegen spec.
sdk/android/src/newarch/java/com/fingerprintjs/reactnative/RNFingerprintjsProPackage.kt Adds TurboModule registration via BaseReactPackage + ReactModuleInfoProvider.
sdk/android/src/main/java/com/fingerprintjs/reactnative/RNFingerprintjsProModule.kt Updates module to extend arch-specific spec and returns object-shaped visitor data.
sdk/android/gradle.properties Removes hardcoded newArchEnabled=false so the library follows the consuming app’s setting.
sdk/android/build.gradle Conditionally applies RN Gradle plugin and sets arch-specific source sets/codegen sources.
sdk/tests/useVisitorData.test.ts Updates mocks to object-shaped visitor data.
sdk/tests/setup.ts Mocks TurboModuleRegistry and preserves legacy NativeModules mock access.
sdk/tests/FingerprintJsProProvider.test.ts Updates assertions for nullability and new call shapes.
e2e-app/src/global.d.ts Adds global typings for RN architecture detection variables.
e2e-app/src/components/ArchInfo.tsx Adds UI to surface arch mode / UI manager in the E2E app.
e2e-app/scripts/retry-cmd.mjs Adds a retry wrapper for flaky CI commands.
e2e-app/pnpm-workspace.yaml Enables shamefullyHoist for the E2E workspace.
e2e-app/e2e/ids.ts Adds test id for UI manager label.
e2e-app/App.tsx Displays arch info and refactors the “Get data” button UI.
.github/workflows/e2e-tests.yml Wraps Detox build/test in retries and adds debugging output (pnpm why react-native).
Suppressed comments (1)

e2e-app/scripts/retry-cmd.mjs:28

  • The error message says node retry.js ..., which doesn’t match this script’s name. This makes CLI guidance confusing when the command is invoked incorrectly.
if (!command) {
  console.error('Usage: node retry.js --retries=<n> "<CMD>"')
  process.exit(1)
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e-app/src/components/ArchInfo.tsx Outdated
Comment thread sdk/android/build.gradle Outdated
Comment thread e2e-app/scripts/retry-cmd.mjs Outdated
@TheUnderScorer
TheUnderScorer marked this pull request as ready for review August 4, 2026 13:59
@TheUnderScorer
TheUnderScorer force-pushed the feature/INTER-970-new-arch branch from adff05a to 18a4159 Compare August 4, 2026 14:00
Base automatically changed from chore/INTER-2077-remove-test-project to main August 5, 2026 09:32
@TheUnderScorer

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: TheUnderScorer <17906692+TheUnderScorer@users.noreply.github.com>

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflict in sdk/README.md (commit 62e7bc6). The conflict was between the PR's New Architecture requirements (RN 0.79+, Expo 53+) and main's older range — kept the PR's version.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Following releases will be created using changesets from this PR:

@fingerprintjs/fingerprintjs-pro-react-native@4.0.0-rc.0

Major Changes

  • Dropped React Native Old Architecture support. The native module is now a TurboModule (New Architecture only) exposed via a Codegen spec.

    This is a breaking change: the SDK now requires React Native >= 0.79 (Expo SDK >= 53) with the New Architecture enabled. (e83c165)

@kevinmia kevinmia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants