react-native-sport
v0.0.2
Published
React Native package for unified interaction with Apple HealthKit and Google Fit
Downloads
6
Maintainers
Readme
react-native-sport
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
import Sport from 'react-native-sport';
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');
});
```