diff --git a/README.md b/README.md index 48c600e090708a01f5abf0cc9210ff1e3c3c61b5..46194f309b3ea45dcfec8dc48286a4859d6a6c0a 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,32 @@ The available HealthKit permissions to use with `initHealthKit` | AppleExerciseTime | [HKQuantityTypeIdentifierAppleExerciseTime](https://developer.apple.com/reference/healthkit/hkquantitytypeidentifierappleexercisetime?language=objc) | ✓ | | | DietaryEnergy | [HKQuantityTypeIdentifierDietaryEnergyConsumed](https://developer.apple.com/reference/healthkit/hkquantitytypeidentifierdietaryenergyconsumed?language=objc) | ✓ | ✓ | +These permissions are exported as constants of the `react-native-apple-healthkit` module. + +```javascript +import AppleHealthKit from 'react-native-apple-healthkit'; + +... + +// get the available permissions from AppleHealthKit.Constants object +const PERMS = AppleHealthKit.Constants.Permissions; + +// setup healthkit read/write permissions from PERMS +const healthKitOptions = { + permissions: { + read: [ + PERMS.StepCount, + PERMS.Height, + ], + write: [ + PERMS.StepCount + ], + } +}; + +... +``` + Options -------