MCPcopy Create free account
hub / github.com/getsentry/sentry-react-native / wrap

Function wrap

packages/core/src/js/sdk.tsx:193–218  ·  view source on GitHub ↗
(
  RootComponent: React.ComponentType<P>,
  options?: ReactNativeWrapperOptions,
)

Source from the content-addressed store, hash-verified

191 * Inits the Sentry React Native SDK with automatic instrumentation and wrapped features.
192 */
193export 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.

Callers 2

wrap.test.tsxFile · 0.90

Calls 1

isWebFunction · 0.90

Tested by

no test coverage detected