react-native-health-connect
react-native-health-connect copied to clipboard
How to setup the library when using Wix react-native-navigation?
Describe the bug I'm struggling to set up the library on my React Native App. I'm using Wix react-native-navigation, and it looks like there is a type mismatch. It would be great if we have an example for this scenario.
In this case, the MainActivity extends NavigationActivity instead of ReactActivity
Screenshots
Environment:
- Health Connect Version: 2.0.1
- React Native Version: 0.73.5
- New architecture enabled: No
Hey!
Thanks for noticing this. Can you please share a minimal reproducible so I can work on it? Thanks :)
Hey @matinzd I've put together a minimal reproducible code (react-native + react-native-navigation + react-native-health-connect). You can find it at this location: https://github.com/predescu/rnn-health-connect
I've commented out the updates on the android/app/src/main/java/com/rnnhealthconnect/MainActivity.kt file so the app can start.
On the screen, there si a button to request the permissions. When you press the button, the app will crash because the HealthConnectPermissionDelegate.setPermissionDelegate(this) code line is missing from the MainActivity.kt
I've run into the same issue. RNN's NavigationActivity extends AppCompatActivity rather than ReactActivity. Anything that extends from ComponentActivity will have registerForActivityResult(), so could setPermissionDelegate() just accept a ComponentActivity?