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.
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:androidandroid/ is gitignored — regenerate it with prebuild.
android/settings.gradleincludes bothreact-native-health-connect(React Native autolinking) andreact-native-health-connect-expo(Expo autolinking). Both are required; see thegradlePathnote in../expo-module.config.json.- The generated Expo package list contains
expo.modules.healthconnect.HealthConnectPackage. android/app/src/main/AndroidManifest.xmlhas a standaloneandroidx.health.ACTION_SHOW_PERMISSIONS_RATIONALEintent-filter and aViewPermissionUsageActivityactivity-alias. Running prebuild twice must not duplicate either.