A React Native package for interacting with Apple HealthKit


License: MIT

Language: Objective-C

Keywords: healthkit, ios, react, react-native

React Native Apple Healthkit

A React Native bridge module for interacting with Apple Healthkit data. Checkout the full documentation


Install the [rn-apple-healthkit] package from npm:

  • Run npm install rn-apple-healthkit --save
  • Run react-native link rn-apple-healthkit

Update info.plist in your React Native project

<string>Read and understand health data.</string>
<string>Share workout data with other apps.</string>

Manual Installation

  1. Run npm install rn-apple-healthkit --save
  2. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  3. Go to node_modulesrn-apple-healthkit and add RCTAppleHealthkit.xcodeproj
  4. In XCode, in the project navigator, select your project. Add libRCTAppleHealthkit.a to your project's Build PhasesLink Binary With Libraries
  5. Click RCTAppleHealthkit.xcodeproj in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic'). In the Search Paths section, look for Header Search Paths and make sure it contains both $(SRCROOT)/../../react-native/React and $(SRCROOT)/../../../React - mark both as recursive.
  6. Enable Healthkit in your application's Capabilities
  7. Compile and run

Get Started

Initialize Healthkit. This will show the Healthkit permissions prompt for any read/write permissions set in the required options object.

Due to Apple's privacy model if an app user has previously denied a specific permission then they can not be prompted again for that same permission. The app user would have to go into the Apple Health app and grant the permission to your react-native app under sources tab.

For any data that is read from Healthkit the status/error is the same for both. This privacy restriction results in having no knowledge of whether the permission was denied (make sure it's added to the permissions options object), or the data for the specific request was nil (ex. no steps recorded today).

For any data written to Healthkit an authorization error can be caught. If an authorization error occurs you can prompt the user to set the specific permission or add the permission to the options object if not present.

If new read/write permissions are added to the options object then the app user will see the Healthkit permissions prompt with the new permissions to allow.

initHealthKit requires an options object with Healthkit permission settings

let options = {
    permissions: {
        read: ["Height", "Weight", "StepCount", "DateOfBirth", "BodyMassIndex", "ActiveEnergyBurned"],
        write: ["Height", "Weight", "StepCount", "BodyMassIndex", "Biotin", "Caffeine", "Calcium", "Carbohydrates", "Chloride", "Cholesterol", "Copper", "EnergyConsumed", "FatMonounsaturated", "FatPolyunsaturated", "FatSaturated", "FatTotal", "Fiber", "Folate", "Iodine", "Iron", "Magnesium", "Manganese", "Molybdenum", "Niacin", "PantothenicAcid", "Phosphorus", "Potassium", "Protein", "Riboflavin", "Selenium", "Sodium", "Sugar", "Thiamin", "VitaminA", "VitaminB12", "VitaminB6", "VitaminC", "VitaminD", "VitaminE", "VitaminK", "Zinc", "Water"]
import AppleHealthKit from 'rn-apple-healthkit';

AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) => {
    if (err) {
        console.log("error initializing Healthkit: ", err);

    // Height Example
    AppleHealthKit.getDateOfBirth(null, (err: Object, results: Object) => {
    if (this._handleHealthkitError(err, 'getDateOfBirth')) {

	value: '1986-09-01T00:00:00.000-0400',
	age: 29



  • Enable fetching basal energy #23
  • remove checkPermission functions in order to use from PR #69
  • Added correct link to permissions. #73
  • Add unified way to get workouts + convert Activity Types to name + isTracked flag #25


  • Basal energy (#23)
  • Fixed issues with saving weight in the past
  • Commited the docs to increase pull request support
  • Add daily samples for:
    • Flights Climbed
    • WalkingRunning Distance
    • Cycling Distance


  • Food and Water (#19)


  • HKQuantityTypeIdentifierActiveEnergyBurned


Supported Apple Permissions

The available Healthkit permissions to use with initHealthKit

Permission Healthkit Identifier Type Read Write
ActiveEnergyBurned HKQuantityTypeIdentifierActiveEnergyBurned
BasalEnergyBurned HKQuantityTypeIdentifierBasalEnergyBurned
BiologicalSex HKCharacteristicTypeIdentifierBiologicalSex
BloodGlucose HKQuantityTypeIdentifierBloodGlucose
BloodPressureDiastolic HKQuantityTypeIdentifierBloodPressureDiastolic
BloodPressureSystolic HKQuantityTypeIdentifierBloodPressureSystolic
BodyMassIndex HKQuantityTypeIdentifierBodyMassIndex
BodyTemperature HKQuantityTypeIdentifierBodyTemperature
DateOfBirth HKCharacteristicTypeIdentifierDateOfBirth
DistanceCycling HKQuantityTypeIdentifierDistanceCycling
DistanceWalkingRunning HKQuantityTypeIdentifierDistanceWalkingRunning
FlightsClimbed HKQuantityTypeIdentifierFlightsClimbed
HeartRate HKQuantityTypeIdentifierHeartRate
Height HKQuantityTypeIdentifierHeight
LeanBodyMass HKQuantityTypeIdentifierLeanBodyMass
MindfulSession HKCategoryTypeIdentifierMindfulSession
RespiratoryRate HKQuantityTypeIdentifierRespiratoryRate
SleepAnalysis HKCategoryTypeIdentifierSleepAnalysis
StepCount HKQuantityTypeIdentifierStepCount
Steps HKQuantityTypeIdentifierSteps
Weight HKQuantityTypeIdentifierBodyMass
BodyFatPercentage HKQuantityTypeIdentifierBodyFatPercentage

These permissions are exported as constants of the rn-apple-healthkit module.

import AppleHealthKit from 'rn-apple-healthkit';

// get the available permissions from AppleHealthKit.Constants object
const PERMS = AppleHealthKit.Constants.Permissions;

// setup healthkit read/write permissions using PERMS
const healthKitOptions = {
    permissions: {
        read:  [
        write: [


  • bpm
  • calorie
  • celsius
  • count
  • day
  • fahrenheit
  • foot
  • gram
  • hour
  • inch
  • joule
  • meter
  • mgPerdL
  • mile
  • minute
  • mmhg
  • mmolPerL
  • percent
  • pound
  • second


This package is an original fork of react-native-apple-Healthkit

Project Statistics

Sourcerank 9
Repository Size 886 KB
Stars 298
Forks 162
Watchers 12
Open issues 53
Dependencies 1
Contributors 18
Tags 29
Last updated
Last pushed

Top Contributors See all

GregWilson Evstropov Evgenii Daniele Volpi furyou81 Terrillo Walls Steve Lee Andreas Amsenius Andrew Allen hira iradkot-herolo Benjamin Paap Bryan Saxon Dr. Martin Probst Matt Crowder Martin RP Jackson Tomlinson Hazem El-Sisy iradkot

Packages Referencing this Repo

A React Native package for interacting with Apple HealthKit
Latest release 0.6.5 - Updated - 298 stars
This is a fork of: https://github.com/terrillo/rn-apple-healthkit.git that includes support for t...
Latest release 0.6.7 - Updated - 298 stars

Recent Tags See all

0.6.5v March 09, 2019
0.6.4v November 10, 2018
0.6.3v February 22, 2018
0.6.1v October 04, 2017
0.6.0v September 17, 2017
0.5.0v September 17, 2017
0.2.0v September 06, 2017
0.1.0v August 31, 2017
v0.2.1 November 06, 2016
v0.2.0 November 06, 2016
v0.1.4 October 11, 2016
v0.1.3 October 11, 2016
v0.1.2 July 18, 2016
v0.1.1 July 09, 2016
v0.1.0 July 09, 2016

Interesting Forks See all

A React Native package for interacting with Apple HealthKit
Objective-C - MIT - Last pushed - 3 stars - 1 forks

Something wrong with this page? Make a suggestion

Last synced: 2019-10-01 15:22:42 UTC

Login to resync this repository