Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 2.66 KB

Expo.md

File metadata and controls

61 lines (45 loc) · 2.66 KB

Expo installation

This package cannot be used in the "Expo Go" app because it requires custom native code.

First install the package with yarn, npm, or npx expo install.

expo install react-native-health

After installing this npm package, add the config plugin to the plugins array of your app.json or app.config.js:

{
  "expo": {
    "plugins": ["react-native-health"]
  }
}

Next, rebuild your app as described in the "Adding custom native code" guide.

API

The plugin provides props for extra customization. Every time you change the props or plugins, you'll need to rebuild (and prebuild) the native app. If no extra properties are added, defaults will be used.

  • healthSharePermission (string): Sets the iOS NSHealthShareUsageDescription permission message to the Info.plist. Defaults to Allow $(PRODUCT_NAME) to check health info.
  • healthUpdatePermission (string): Sets the iOS NSHealthUpdateUsageDescription permission message to the Info.plist. Defaults to Allow $(PRODUCT_NAME) to update health info.
  • isClinicalDataEnabled (boolean): Adds health-records to the com.apple.developer.healthkit.access entitlement in the iOS project. Defaults to false.
  • healthClinicalDescription (string): Sets the iOS NSHealthClinicalHealthRecordsShareUsageDescription permission message to the Info.plist. Defaults to Allow $(PRODUCT_NAME) to check health info.

app.config.js

{
  "expo": {
    "plugins": [
      [
        "react-native-health",
        {
          "isClinicalDataEnabled": true,
          "healthSharePermission": "Custom health share permission",
          "healthUpdatePermission": "Custom health update permission",
          "healthClinicalDescription": "Custom health share permission for clinical data"
        }
      ]
    ]
  }
}

Background Processing

Background processing is not currently supported by this plugin.

Capabilities

This plugin will enable the iOS com.apple.developer.healthkit entitlement, but in order to sync this with the bundle identifier' production capabilities you'll need to do one of two things:

  • Automatic: Build the app with EAS build
  • Manual: Visit Apple developer portal and enable the HealthKit capability for your bundle identifier before building for production. This can also be done via Xcode.