( RootComponent: React.ComponentType<P>, options?: ReactNativeWrapperOptions, )
| 191 | * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features. |
| 192 | */ |
| 193 | export function wrap<P extends Record<string, unknown>>( |
| 194 | RootComponent: React.ComponentType<P>, |
| 195 | options?: ReactNativeWrapperOptions, |
| 196 | ): React.ComponentType<P> { |
| 197 | const profilerProps = { |
| 198 | ...options?.profilerProps, |
| 199 | name: RootComponent.displayName ?? 'Root', |
| 200 | updateProps: {}, |
| 201 | }; |
| 202 | |
| 203 | const ProfilerComponent = isWeb() ? Profiler : ReactNativeProfiler; |
| 204 | |
| 205 | const RootApp: React.FC<P> = appProps => { |
| 206 | return ( |
| 207 | <TouchEventBoundary {...(options?.touchEventBoundaryProps ?? {})}> |
| 208 | <ProfilerComponent {...profilerProps}> |
| 209 | <FeedbackFormProvider> |
| 210 | <RootComponent {...appProps} /> |
| 211 | </FeedbackFormProvider> |
| 212 | </ProfilerComponent> |
| 213 | </TouchEventBoundary> |
| 214 | ); |
| 215 | }; |
| 216 | |
| 217 | return RootApp; |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * If native client is available it will trigger a native crash. |
no test coverage detected