JSPM

react-native-sport

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q14983F
  • License ISC

React Native package for unified interaction with Apple HealthKit and Google Fit

Package Exports

  • react-native-sport

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-sport) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-sport

npm version Downloads

React Native package providing unified access to Apple Health and Google Fit

Getting started

This package provides a common API for external packages:

https://github.com/iteratorsmobile/react-native-google-fit

and

https://github.com/iteratorsmobile/rn-apple-healthkit

Those are one of few wrappers for native APIs, that cover big spectrum of native functionalities, and have a group of contributors. We decided to develop this library aiming to unify, simplify, and extend possibilities of the above.

For now, this library assumes that you add Health and Fit packages to your project yourself. Please refer to install guides for each library. After that, you can just $ npm install react-native-sport --save or $ yarn add react-native-sport

USAGE

  1. import Sport from 'react-native-sport';

  2. Authorize:

   // This approach is meant to simplify auth process, you either get an initialization error, or a table of base data results; 

    Sport.hello().then(([
      { value: heightValue, ...otherHeightData },
      { value: weightValue, ...otherWeightData },
      { value: birthValue, age },
      { value: sexValue },
    ]) => {
      this.dateOfBirth = moment(birthValue).format('D-M-YY');
    }).catch((err) => {
      console.log('error');
    });
    ```