Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/kingstinct/react-native-healthkit/llms.txt

Use this file to discover all available pages before exploring further.

Before using HealthKit APIs, you should check if HealthKit is available on the device. HealthKit is available on iPhone and Apple Watch, but not on iPad or Mac.

Check availability

isHealthDataAvailable

Synchronously check if HealthKit is available.
function isHealthDataAvailable(): boolean
Returns: boolean - true if HealthKit is available, false otherwise
import { isHealthDataAvailable } from '@kingstinct/react-native-healthkit';

const isAvailable = isHealthDataAvailable();

if (isAvailable) {
  // Safe to use HealthKit APIs
  await requestAuthorization({ toRead: ['HKQuantityTypeIdentifierStepCount'] });
} else {
  console.log('HealthKit is not available on this device');
}

isHealthDataAvailableAsync

Asynchronously check if HealthKit is available.
function isHealthDataAvailableAsync(): Promise<boolean>
Returns: Promise<boolean> - Resolves to true if available
const isAvailable = await isHealthDataAvailableAsync();
Use the synchronous version (isHealthDataAvailable) in most cases. The async version is provided for consistency with other HealthKit APIs.

Platform behavior

React Native HealthKit is iOS-only. On Android and other platforms, these functions will return false and log a warning.
The library handles platform detection automatically:
import { Platform } from 'react-native';
import { isHealthDataAvailable } from '@kingstinct/react-native-healthkit';

if (Platform.OS === 'ios' && isHealthDataAvailable()) {
  // HealthKit is available
}

Device availability

HealthKit is available on:
  • ✅ iPhone (iOS 8+)
  • ✅ Apple Watch (watchOS 2+)
  • ❌ iPad
  • ❌ Mac
  • ❌ iPod touch (most models)

Check specific data type availability

Some data types are only available on certain iOS versions. Use the Core module to check:
import { Core } from '@kingstinct/react-native-healthkit';

// Check if a specific data type is available
const isStepsAvailable = Core.isObjectTypeAvailable(
  'HKQuantityTypeIdentifierStepCount'
);

// Check multiple data types at once
const availability = Core.areObjectTypesAvailable([
  'HKQuantityTypeIdentifierStepCount',
  'HKQuantityTypeIdentifierCyclingCadence', // iOS 17+
  'HKQuantityTypeIdentifierTimeInDaylight', // iOS 17+
]);

console.log(availability);
// {
//   HKQuantityTypeIdentifierStepCount: true,
//   HKQuantityTypeIdentifierCyclingCadence: true,
//   HKQuantityTypeIdentifierTimeInDaylight: true,
// }

React Hook

For declarative availability checking, use the useIsHealthDataAvailable hook:
import { useIsHealthDataAvailable } from '@kingstinct/react-native-healthkit';

function MyComponent() {
  const isAvailable = useIsHealthDataAvailable();

  if (!isAvailable) {
    return <Text>HealthKit is not available on this device</Text>;
  }

  return <HealthKitData />;
}
See useIsHealthDataAvailable for details.

Build docs developers (and LLMs) love