admin管理员组

文章数量:1278950

I am developing a React Native app that retrieves health data using Google Health Connect. However, I am encountering the following error:

(NOBRIDGE) ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'HealthConnect' could not be found. Verify that a module by this name is registered in the native binary.

The issue seems to be related to HealthConnect not being properly linked or initialized. When I comment out the lines using my custom hook (useHealthData), in counter.tsx the app works fine with manually entered data, and the error disappears.

//const { steps, distance } = useHealthData(date); // the app uses the custom hook (useHealthData) that does the logic of getting the data 

{/*<RingProgress radius={150} strokeWidth={50} progress={steps / STEPS_GOAL} />*/}


<RingProgress radius={150} strokeWidth={50} progress={0.8} />
<ThemedView style={styles.values}>
              
{/*<Value label="Steps" value={steps.toString()} />
<Value label="Distance" value={`${distance.toFixed(2)} km`} />*/}

The error appears only when trying to access health data.

you can see my full app and all other files in my github repository:

What I’ve Tried:

Ensured I installed react-native-health-connect correctly. Checked if useHealthData is properly imported. Confirmed the app is running on Android, since Health Connect is not available on iOS. Restarted Metro and cleaned the build (npx react-native start --reset-cache and cd android && ./gradlew clean). Rebuilt the app (npx react-native run-android).

I do not understand where is my app failing as a am new to react native. Any help and suggestions would be appreciated.

本文标签: HealthConnect Module Not FoundTurboModuleRegistry Error in React NativeStack Overflow