@kingstinct/react-native-healthkit 16.0.0 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@ React Native bindings for HealthKit with full TypeScript and Promise support cov
15
15
  | 75+ Workout Activity Types | ✅ | ✅ | ✅ | Swimming, running, table tennis etc.. |
16
16
  | Correlation Types | ✅ | ✅ | ✅ | Food and blood pressure |
17
17
  | Document Types | ✅ | ❌ | ✅ | [CDA documents](https://developer.apple.com/documentation/healthkit/hkcdadocument) exposed as Base64 data |
18
- | Clinical Records | ⚠️ | ❌ | ⚠️ | Lab results etc in [FHIR JSON format](https://www.hl7.org/fhir/json.html) (see [Clinical Records](https://github.com/kingstinct/react-native-healthkit#clinical-records)) |
18
+ | Clinical Records | ✅ | ❌ | ✅ | Lab results, immunizations etc. as [FHIR](https://www.hl7.org/fhir/json.html) via [`@react-native-healthkit/health-records`](#clinical-records) |
19
19
 
20
20
  ### Disclaimer
21
21
 
@@ -206,7 +206,22 @@ We're striving to do as straight a mapping as possible to the Native Libraries.
206
206
 
207
207
  ## Clinical Records
208
208
 
209
- For accessing Clinical Records use old version (3.x) or use specific branch "including-clinical-records". The reason is we cannot refer to this code natively in apps without getting approval from Apple, this could probably be solved by the config plugin but we haven't had time to look into it yet.
209
+ Clinical health records (allergies, conditions, immunizations, lab results, medications, procedures, vital signs, clinical notes and coverage) live in a separate package, [`@react-native-healthkit/health-records`](https://github.com/kingstinct/react-native-healthkit/tree/master/packages/health-records), so apps that don't need them avoid the extra entitlement and App Review scrutiny.
210
+
211
+ - Records are read-only and delivered as FHIR resources, with anchored queries, change subscriptions and background delivery.
212
+ - The app needs the HealthKit **Clinical Health Records** capability (`health-records` in `com.apple.developer.healthkit.access`) and an `NSHealthClinicalHealthRecordsShareUsageDescription`. Its Expo config plugin sets up both.
213
+ - Health Records are only available in supported regions and never on the simulator, so check `supportsHealthRecords()` before offering the feature.
214
+
215
+ ```ts
216
+ import { supportsHealthRecords, requestAuthorization, queryClinicalRecords } from '@react-native-healthkit/health-records'
217
+
218
+ if (supportsHealthRecords()) {
219
+ await requestAuthorization(['HKClinicalTypeIdentifierLabResultRecord'])
220
+ const labResults = await queryClinicalRecords('HKClinicalTypeIdentifierLabResultRecord', { limit: 0 })
221
+ }
222
+ ```
223
+
224
+ See the [health-records README](https://github.com/kingstinct/react-native-healthkit/blob/master/packages/health-records/README.md) for installation, configuration and the full API.
210
225
 
211
226
  ## Android alternatives
212
227
 
@@ -1,7 +1,12 @@
1
1
  require "json"
2
+ require "pathname"
2
3
 
3
4
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
5
 
6
+ # Resolved like Node resolves the dependency, so monorepo and node_modules layouts both work.
7
+ core_ios_dir = Pathname.new(File.join(File.dirname(`node --print "require.resolve('@react-native-healthkit/core/package.json', { paths: ['#{__dir__}'] })"`.strip), "ios"))
8
+ .relative_path_from(Pathname.new(__dir__)).to_s
9
+
5
10
  Pod::Spec.new do |s|
6
11
  s.name = "ReactNativeHealthkit"
7
12
  s.version = package["version"]
@@ -24,7 +29,9 @@ Pod::Spec.new do |s|
24
29
  # C++ compiler flags, mainly for folly.
25
30
  "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES",
26
31
  # Allow importing Objective-C headers in Swift without bridging header
27
- "CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES" => "YES"
32
+ "CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES" => "YES",
33
+ # Core's `internal import ReactNativeHealthkitCore_Private` must resolve here too (explicit module builds).
34
+ "SWIFT_INCLUDE_PATHS" => "$(inherited) \"$(PODS_TARGET_SRCROOT)/#{core_ios_dir}\""
28
35
  }
29
36
 
30
37
  load 'nitrogen/generated/ios/ReactNativeHealthkit+autolinking.rb'
@@ -571,6 +571,7 @@ var HeartRateRecoveryTestType;
571
571
  HeartRateRecoveryTestType[HeartRateRecoveryTestType["maxExercise"] = 1] = "maxExercise";
572
572
  HeartRateRecoveryTestType[HeartRateRecoveryTestType["predictionSubMaxExercise"] = 2] = "predictionSubMaxExercise";
573
573
  HeartRateRecoveryTestType[HeartRateRecoveryTestType["predictionNonExercise"] = 3] = "predictionNonExercise";
574
+ HeartRateRecoveryTestType[HeartRateRecoveryTestType["stepTest"] = 4] = "stepTest";
574
575
  })(HeartRateRecoveryTestType || (exports.HeartRateRecoveryTestType = HeartRateRecoveryTestType = {}));
575
576
  var HeartRateSensorLocation;
576
577
  (function (HeartRateSensorLocation) {
@@ -568,6 +568,7 @@ export var HeartRateRecoveryTestType;
568
568
  HeartRateRecoveryTestType[HeartRateRecoveryTestType["maxExercise"] = 1] = "maxExercise";
569
569
  HeartRateRecoveryTestType[HeartRateRecoveryTestType["predictionSubMaxExercise"] = 2] = "predictionSubMaxExercise";
570
570
  HeartRateRecoveryTestType[HeartRateRecoveryTestType["predictionNonExercise"] = 3] = "predictionNonExercise";
571
+ HeartRateRecoveryTestType[HeartRateRecoveryTestType["stepTest"] = 4] = "stepTest";
571
572
  })(HeartRateRecoveryTestType || (HeartRateRecoveryTestType = {}));
572
573
  export var HeartRateSensorLocation;
573
574
  (function (HeartRateSensorLocation) {
@@ -545,7 +545,8 @@ export declare enum HeartRateMotionContext {
545
545
  export declare enum HeartRateRecoveryTestType {
546
546
  maxExercise = 1,
547
547
  predictionSubMaxExercise = 2,
548
- predictionNonExercise = 3
548
+ predictionNonExercise = 3,
549
+ stepTest = 4
549
550
  }
550
551
  export declare enum HeartRateSensorLocation {
551
552
  other = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingstinct/react-native-healthkit",
3
- "version": "16.0.0",
3
+ "version": "16.1.0",
4
4
  "description": "React Native bindings for HealthKit",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -103,7 +103,7 @@
103
103
  "typescript": "~5.9.3"
104
104
  },
105
105
  "dependencies": {
106
- "@react-native-healthkit/core": "16.0.0"
106
+ "@react-native-healthkit/core": "16.1.0"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "react": ">=19",
@@ -2104,6 +2104,11 @@
2104
2104
  "name": "predictionNonExercise",
2105
2105
  "swiftName": "HKHeartRateRecoveryTestTypePredictionNonExercise",
2106
2106
  "rawValue": 3
2107
+ },
2108
+ {
2109
+ "name": "stepTest",
2110
+ "swiftName": "HKHeartRateRecoveryTestTypeStepTest",
2111
+ "rawValue": 4
2107
2112
  }
2108
2113
  ]
2109
2114
  },
@@ -770,6 +770,7 @@ export enum HeartRateRecoveryTestType {
770
770
  maxExercise = 1,
771
771
  predictionSubMaxExercise = 2,
772
772
  predictionNonExercise = 3,
773
+ stepTest = 4,
773
774
  }
774
775
  export enum HeartRateSensorLocation {
775
776
  other = 0,