You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Because the new react-native architecture lazy loads modules by default, require('react-native').NativeModules is an empty object at app startup time. Search for "Lazy module loading by default" in https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here
To Reproduce
Load the app on React Native 0.76.0 and observe that all functions expected on AppleHealthKit are undefined.
Expected behavior
All functions on AppleHealthKit are should be defined at access time.
Workaround Confirmed to Work
Per this user's helpful comment (facebook/react-native#29228 (comment)), this workaround fixes the issue for MY app which only uses a handful of functions from react-native-health. This is far from a global solution though. I'm using yarn so I'm able to simply do a yarn patch react-native-health to be unblocked with this change:
Describe the bug
Because the new react-native architecture lazy loads modules by default,
require('react-native').NativeModules
is an empty object at app startup time. Search for "Lazy module loading by default" in https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-hereTo Reproduce
Load the app on React Native 0.76.0 and observe that all functions expected on
AppleHealthKit
are undefined.Expected behavior
All functions on
AppleHealthKit
are should be defined at access time.Workaround Confirmed to Work
Per this user's helpful comment (facebook/react-native#29228 (comment)), this workaround fixes the issue for MY app which only uses a handful of functions from
react-native-health
. This is far from a global solution though. I'm usingyarn
so I'm able to simply do ayarn patch react-native-health
to be unblocked with this change:index.js
The text was updated successfully, but these errors were encountered: