react-native-health icon indicating copy to clipboard operation
react-native-health copied to clipboard

getElectrocardiogramSamples is not a function

Open RayaneSantos opened this issue 3 years ago • 3 comments

Hello everyone,

I'm trying to use getElectrocardiogramSamples and receiving the message 'TypeError: _reactNativeHealth.default.getElectrocardiogramSamples is not a function'

  • getOxygenSaturationSamples return a similar error mensagem.

  • getDailyStepCountSamples works fine.

  • initHealthKit return 1

  • isAvailable return true

To understand better the problem, we use getOwnPropertyNames, like this 'console.log('getOwnPropertyNames:', Object.getOwnPropertyNames(AppleHealthKit))', and return:

["isAvailable", "initHealthKit", "initStepCountObserver", "getBiologicalSex", "getDateOfBirth", "getLatestWeight", "getWeightSamples", "saveWeight", "getLatestHeight", "getHeightSamples", "saveHeight", "getLatestBmi", "saveBmi", "getLatestBodyFatPercentage", "getLatestLeanBodyMass", "getStepCount", "getSamples", "setObserver", "getDailyStepCountSamples", "saveSteps", "getDistanceWalkingRunning", "getDailyDistanceWalkingRunningSamples", "getDistanceCycling", "getDailyDistanceCyclingSamples", "getFlightsClimbed", "getDailyFlightsClimbedSamples", "saveFood", "saveWater", "getHeartRateSamples", "getActiveEnergyBurned", "getBasalEnergyBurned", "getBodyTemperatureSamples", "getBloodPressureSamples", "getRespiratoryRateSamples", "getBloodGlucoseSamples", "getSleepSamples", "getInfo", "saveMindfulSession", "getConstants", "Constants"]

We didn't find the getElectrocardiogramSamples method in the return of getOwnPropertyNames

  • react-native-health version 1.10.0

Could someone help me understand why I'm getting this error? Thanks in advance!

RayaneSantos avatar Sep 02 '21 15:09 RayaneSantos

It looks like a lot of methods are missing in your console log output. Did you use a version of this library before 1.10.0? Can you try cleaning the build folder, then uninstall/reinstall this library before rebuilding?

klandell avatar Sep 02 '21 16:09 klandell

Hello Klandell, thank you so much for the quick reply.

Before we were using rn-apple-healthkit, when we migrated we started with react-native-health version 1.10.0.

I've already done the clean, remove and added it to the lib, but no changes in the return of getOwnPropertyNames or error message.

Do you have any other suggestions?

RayaneSantos avatar Sep 02 '21 17:09 RayaneSantos

Really weird indeed, looks like your lib is not updated. Don't see anything from cleaning the build again.

macelai avatar Sep 08 '21 13:09 macelai