Fix plugin crash and preserve infoPlist values when props are omitted#353
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: e28d5f7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Copilot
AI
changed the title
[WIP] Fix package not finding NSHealthShareUsageDescription in app.json
Fix plugin crash and preserve infoPlist values when props are omitted
Jun 3, 2026
Work in progress to address missing NSHealthShareUsageDescription in app.json.
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Expo config plugin for @kingstinct/react-native-healthkit to (1) avoid crashing when the plugin is configured without an options object and (2) stop overwriting expo.ios.infoPlist usage-description values unless explicitly overridden by plugin props.
Changes:
- Guard plugin option access with optional chaining so
propscan be omitted safely. - Prefer plugin-provided usage description strings, otherwise keep any existing
infoPliststrings, otherwise fall back to defaults. - Add a patch changeset for publishing the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/react-native-healthkit/app.plugin.ts | Updates TS config plugin logic to handle omitted props and preserve existing Info.plist usage descriptions. |
| packages/react-native-healthkit/app.plugin.js | Updates the published JS config plugin with the same omitted-props and fallback behavior. |
| .changeset/kind-ties-know.md | Adds a patch changeset entry for releasing the fix. |
…eck and clean up changeset - Replace `as string | undefined` cast + `??` with explicit `typeof === 'string'` runtime check so non-string infoPlist values (booleans, objects) are never written back as usage descriptions - Remove misleading comment about `false` handling that no longer reflects actual behavior - Update changeset to remove [WIP] prefix and describe both fixes (crash + value preservation) https://claude.ai/code/session_01XRdixDjYwJajsMBdddVHrT
….plist Apps that only read health data don't need NSHealthUpdateUsageDescription. Passing false skips writing the key entirely, mirroring the existing false opt-out pattern used by the background-delivery entitlement. https://claude.ai/code/session_01XRdixDjYwJajsMBdddVHrT
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.
Using the plugin without an options array (
"@kingstinct/react-native-healthkit") causes a crash becausepropsisundefined, and accessingprops.NSHealthShareUsageDescriptionthrows. Additionally, values set viaexpo.ios.infoPlistwere always silently overwritten by the plugin's hardcoded defaults.Changes
app.plugin.ts/app.plugin.js: InwithInfoPlistPlugin, use optional chaining onpropsand add a fallback to the existingmodResultsvalue before the hardcoded defaultThe fallback chain is now:
infoPlistvalue (set viaexpo.ios.infoPlistinapp.json)"<AppName> wants to read/update your health data")This means both of the following configurations now work correctly without conflict:
{ "expo": { "plugins": ["@kingstinct/react-native-healthkit"], "ios": { "infoPlist": { "NSHealthShareUsageDescription": "Share activity data with $(PRODUCT_NAME)", "NSHealthUpdateUsageDescription": "Share activity data from $(PRODUCT_NAME)" } } } }