Skip to content

xmartlabs/react-native-health-link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-health-link

Warning

This module is currently in alpha. While it provides core functionality, it is still under active development and may contain bugs.

A simple way to work with HealthKit on iOS and Health Connect on Android in React Native. Access health data like steps, sleep, and more with one interface that unifies react-native-health and react-native-health-connect.

Installation

To install and setup this package, please refer to the installation guide.

Usage

import { useState } from 'react';
import { Text } from 'react-native';
import {
  initializeHealth,
  HealthLinkDataType,
  HealthLinkPermissions,
  read,
} from 'react-native-health-link';

initializeHealth({
  read: [HealthLinkPermissions.BloodGlucose],
  write: [HealthLinkPermissions.BloodGlucose],
});

export default function App() {
  const [bloodGlucose, setBloodGlucose] = useState<number | undefined>();

  read(HealthLinkDataType.BloodGlucose, {
    startDate: new Date('2025-01-01').toISOString(),
  }).then((data) => {
    setBloodGlucose(data[0]?.value);
  });
  return <Text>Your blood glucose is {bloodGlucose} </Text>;
}

Documentation

SDK functions:

initializeHealth

isAvailable

Data functions:

read

write

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Acknowledgements

This library provides a common interface to simplify cross-platform use of health tools; most of the credit goes to react-native-health and react-native-health-connect.


Made with create-react-native-library

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published