[INTER-970] Add support for new arch - #261
Conversation
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success72 tests passing in 4 suites. Report generated by 🧪jest coverage report action from 62e7bc6 Show full coverage report
|
cd82e2f to
e38aa15
Compare
380c356 to
7b7f0f7
Compare
There was a problem hiding this comment.
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
newArchEnabledis 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
adff05a to
18a4159
Compare
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: TheUnderScorer <17906692+TheUnderScorer@users.noreply.github.com>
Resolved the merge conflict in |
🚀 Following releases will be created using changesets from this PR:@fingerprintjs/fingerprintjs-pro-react-native@4.0.0-rc.0Major Changes
|
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
src/specs/NativeRNFingerprintjsPro.tsandcodegenConfiginpackage.json.TurboModuleRegistry.getEnforcing, replacing the hand-writtenreact-native.d.tsaugmentation.getVisitorData's native return from a tuple to an object(
{ requestId, confidenceScore, visitorDataJson, sealedResult }), since Codegen can't expresstuples. Internal only; the public
VisitorDatatype is unchanged.Android
NativeRNFingerprintjsProSpecdirectlyRNFingerprintjsProPackageusingBaseReactPackage+ReactModuleInfoProvider(TurboModuleregistration).
build.gradleunconditionally applies the React Gradle plugin (runs library Codegen) and alwaysadds 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_METHODare kept (module registration / method export).@objcselectors/params to the generated spec.podspec: addinstall_modules_dependencies(s); excludeios/build/**fromsource_files.Native method signature cleanup
Internal ergonomics of the
RNFingerprintjsPromodule. 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.getVisitorIdWithTimeout/getVisitorDataWithTimeout;getVisitorId/getVisitorDatanow take a trailing nullable
timeout: Double | null(null= no timeout,0still valid). WithOld Architecture gone, the timeout is a genuine nullable — Codegen maps
Double | nullto Android@Nullable Double/ iOSNSNumber *— so the previous negative-value sentinel is dropped.Tooling, CI & docs
entries from
compatibility.mjsandreactNativeMetadata.ts, deleteapp-config-tools/arch.ts,expoConfigPatchers.ts, andplugins/withAndroidMavenRepo.js(the Expo 50 Maven-repo workaround),and drop
setCompileSdkVersion/stripAndroidExtraBuildProperties.app.config.tsnow hardcodesnewArchEnabled = true..github/workflows/e2e-tests.yml): reduce the matrix to`['local', '0.79', '0.81', '0.83', '0.85'].
README.md/sdk/README.mdstate RN 0.79+ (New Architecture only) / Expo 53+.Validation
pnpm build+pnpm test(72 passed) +pnpm lint+pnpm test:dtsare green.