How to access rootView in iOS native code
I want to integrate react-native-sentry. It needs to add some native code:
[RNSentry installWithRootView:rootView];
Ref: https://docs.sentry.io/clients/react-native/#client-configuration
So this question is how can I access rootView in AppDelegate.m when using react-native-navigation.
Environment
- React Native Navigation version: v2.0.0-experimental.276
- React Native version: 0.41
- Platform(s) (iOS, Android, or both?): iOS
Navigation has multiple RCTRootViews (that's the essence of this project), so if anything, you should use the installWithBridge method.
You can currently access the bridge by
[[RCCManager sharedInstance] getBridge]
@DanielZlotin Hi! But I still don not know how to use it. Thanks a lot.
@zhaiyjgithub instead of: [RNSentry installWithRootView:rootView]; use this one: [RNSentry installWithBridge:[[RCCManager sharedInstance] getBridge]];
I used [RNSentry installWithBridge:[[RCCManager sharedInstance] getBridge]]; in my AppDelegate.m, but my app just gets stuck on the launch screen (iOS). Xcode logs seems to show it's stuck on downloading updates from CodePush, then nothing more. Anyone else with experience integrating with other native libs like CodePush, with or without interference?
@Mindaugas-Jacionis Thank you, that definitely resolved my issue!
In react-native-navigation v2 the RCCManager file is removed and for integrating sentry you can use [RNSentry installWithBridge:[ReactNativeNavigation getBridge]]; in AppDelegate.m file.