Skip to content

Latest commit

 

History

History

README.md

Expo example (SDK 57)

Exercises the Expo path of react-native-health-connect: the bundled config plugin and the bundled Expo module in ../android-expo, which registers HealthConnectPermissionDelegate from a ReactActivityLifecycleListener.

Note there is no MainActivity edit anywhere in this app — that is the point. If the Expo module stops being autolinked, requestPermission fails with UninitializedPropertyAccessException.

Running

This example is its own Yarn project rather than a workspace of the root. Yarn refuses to materialise a link:/portal: symlink whose target is an ancestor of the project, and Expo autolinking needs a real node_modules entry to discover ../android-expo — unlike React Native CLI autolinking, it does not read react-native.config.js. The postinstall script here creates that symlink after the link step.

cd example-expo
yarn install
npx expo prebuild --clean --platform android
npx expo run:android

android/ is gitignored — regenerate it with prebuild.

What to check after prebuild

  • android/settings.gradle includes both react-native-health-connect (React Native autolinking) and react-native-health-connect-expo (Expo autolinking). Both are required; see the gradlePath note in ../expo-module.config.json.
  • The generated Expo package list contains expo.modules.healthconnect.HealthConnectPackage.
  • android/app/src/main/AndroidManifest.xml has a standalone androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE intent-filter and a ViewPermissionUsageActivity activity-alias. Running prebuild twice must not duplicate either.