fix: React Native Codegen issue with version 0.84#284
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes React Native 0.84 integration issues around the getUserAttributes TurboModule/codegen contract by ensuring native callbacks return a consistent (non-null) attributes object and by aligning the TypeScript spec with that behavior.
Changes:
- iOS: sanitize user attributes to exclude null/NSNull values before returning them via callback.
- Android: always invoke
getUserAttributescallback with(null, emptyMap)when no user is found (instead of invoking with no args). - TypeScript codegen spec: remove
nullfromUserAttributesvalue union and makegetUserAttributescallback result non-nullable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| js/codegenSpecs/NativeMParticle.ts | Tightens UserAttributes and getUserAttributes callback typing for codegen. |
| ios/RNMParticle/RNMParticle.mm | Filters null values out of user attributes before returning to JS. |
| android/src/main/java/com/mparticle/react/MParticleModule.kt | Ensures callback is invoked with consistent (error, result) args even when user is missing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`NativeMParticle.ts (line 6) uses TSArrayType shorthand (string[]) which is unsupported by the React Native codegen` Made the types more flexible to support the new React Native 0.84.0 version. - In RNMParticle.mm, added sanitization for user attributes to exclude null values before returning them in the callback. - Updated TypeScript definitions to reflect the changes in callback result types.
7def449 to
7507daf
Compare
denischilik
reviewed
Mar 5, 2026
jamesnrokt
previously approved these changes
Mar 5, 2026
8ea4f53 to
eea1fa9
Compare
jamesnrokt
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The app compilation failed when integrated into an app that uses React Native 0.84.
NativeMParticle.ts (line 6) uses TSArrayType shorthand (string[]) which is unsupported by the React Native codegenRemoved the null type in the mapTesting Plan
Tested locally with
0.76.9and0.84Master Issue
Closes https://go.mparticle.com/work/REPLACEME