Commit 026fec5b authored by Terrillo Walls's avatar Terrillo Walls

getLatestWeight updated

parent 671b3bf6
...@@ -94,26 +94,31 @@ When the module has been successfully initialized you can read and write HealthK ...@@ -94,26 +94,31 @@ When the module has been successfully initialized you can read and write HealthK
var AppleHealthKit = require('rn-apple-healthkit'); var AppleHealthKit = require('rn-apple-healthkit');
var _ = require('lodash'); var _ = require('lodash');
...
AppleHealthKit.getLatestWeight(null, (err: Object, weight: Object) => { AppleHealthKit.initHealthKit(null: Object, (err: string, res: Object) => {
...
AppleHealthKit.getLatestWeight(null, (err: Object, weight: Object) => {
if(err){ if(err){
console.log("error getting current weight: ", err); console.log("error getting current weight: ", err);
return; return;
} }
// use weight.value ... // use weight.value ...
}); });
... ...
let options = {value: 200}; let options = {value: 200};
AppleHealthKit.saveWeight(options: Object, (err: Object, res: Object) => { AppleHealthKit.saveWeight(options: Object, (err: Object, res: Object) => {
if(err){ if(err){
console.log("error saving weight to healthkit: ", err); console.log("error saving weight to healthkit: ", err);
return; return;
} }
// weight successfully saved // weight successfully saved
}); });
}
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment