@sentry/react-native 5.19.3 → 5.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/RNSentry.podspec +1 -1
  3. package/android/src/main/java/io/sentry/react/{MapConverter.java → RNSentryMapConverter.java} +1 -1
  4. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +55 -10
  5. package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +139 -0
  6. package/android/src/main/java/io/sentry/react/RNSentryPackage.java +13 -0
  7. package/android/src/main/java/io/sentry/react/RNSentryReactFragmentLifecycleTracer.java +99 -0
  8. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +15 -1
  9. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +15 -0
  10. package/dist/js/NativeRNSentry.d.ts +3 -0
  11. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  12. package/dist/js/NativeRNSentry.js.map +1 -1
  13. package/dist/js/index.d.ts +2 -2
  14. package/dist/js/index.d.ts.map +1 -1
  15. package/dist/js/index.js +1 -1
  16. package/dist/js/index.js.map +1 -1
  17. package/dist/js/tracing/index.d.ts +1 -0
  18. package/dist/js/tracing/index.d.ts.map +1 -1
  19. package/dist/js/tracing/index.js +1 -0
  20. package/dist/js/tracing/index.js.map +1 -1
  21. package/dist/js/tracing/reactnativeprofiler.d.ts +4 -0
  22. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  23. package/dist/js/tracing/reactnativeprofiler.js +12 -0
  24. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  25. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  26. package/dist/js/tracing/reactnativetracing.js +15 -2
  27. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  28. package/dist/js/tracing/reactnavigation.d.ts +10 -1
  29. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  30. package/dist/js/tracing/reactnavigation.js +69 -4
  31. package/dist/js/tracing/reactnavigation.js.map +1 -1
  32. package/dist/js/tracing/timetodisplay.d.ts +46 -0
  33. package/dist/js/tracing/timetodisplay.d.ts.map +1 -0
  34. package/dist/js/tracing/timetodisplay.js +198 -0
  35. package/dist/js/tracing/timetodisplay.js.map +1 -0
  36. package/dist/js/tracing/timetodisplaynative.d.ts +17 -0
  37. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -0
  38. package/dist/js/tracing/timetodisplaynative.js +27 -0
  39. package/dist/js/tracing/timetodisplaynative.js.map +1 -0
  40. package/dist/js/tracing/timetodisplaynative.types.d.ts +14 -0
  41. package/dist/js/tracing/timetodisplaynative.types.d.ts.map +1 -0
  42. package/dist/js/tracing/timetodisplaynative.types.js +2 -0
  43. package/dist/js/tracing/timetodisplaynative.types.js.map +1 -0
  44. package/dist/js/tracing/utils.d.ts +8 -3
  45. package/dist/js/tracing/utils.d.ts.map +1 -1
  46. package/dist/js/tracing/utils.js +19 -0
  47. package/dist/js/tracing/utils.js.map +1 -1
  48. package/dist/js/utils/sentryeventemitter.d.ts +24 -0
  49. package/dist/js/utils/sentryeventemitter.d.ts.map +1 -0
  50. package/dist/js/utils/sentryeventemitter.js +82 -0
  51. package/dist/js/utils/sentryeventemitter.js.map +1 -0
  52. package/dist/js/version.d.ts +1 -1
  53. package/dist/js/version.js +1 -1
  54. package/dist/js/version.js.map +1 -1
  55. package/dist/js/wrapper.d.ts +5 -0
  56. package/dist/js/wrapper.d.ts.map +1 -1
  57. package/dist/js/wrapper.js +20 -3
  58. package/dist/js/wrapper.js.map +1 -1
  59. package/ios/RNSentry.h +2 -1
  60. package/ios/RNSentry.mm +44 -0
  61. package/ios/RNSentryDependencyContainer.h +15 -0
  62. package/ios/RNSentryDependencyContainer.m +32 -0
  63. package/ios/RNSentryEvents.h +3 -0
  64. package/ios/RNSentryEvents.m +3 -0
  65. package/ios/RNSentryFramesTrackerListener.h +17 -0
  66. package/ios/RNSentryFramesTrackerListener.m +30 -0
  67. package/ios/RNSentryOnDrawReporter.m +70 -0
  68. package/ios/RNSentryRNSScreen.h +7 -0
  69. package/ios/RNSentryRNSScreen.m +26 -0
  70. package/package.json +3 -2
  71. package/scripts/expo-upload-sourcemaps.js +15 -1
  72. package/src/js/NativeRNSentry.ts +3 -0
  73. package/ts3.8/dist/js/NativeRNSentry.d.ts +3 -0
  74. package/ts3.8/dist/js/index.d.ts +2 -2
  75. package/ts3.8/dist/js/tracing/index.d.ts +1 -0
  76. package/ts3.8/dist/js/tracing/reactnativeprofiler.d.ts +4 -0
  77. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +10 -1
  78. package/ts3.8/dist/js/tracing/timetodisplay.d.ts +46 -0
  79. package/ts3.8/dist/js/tracing/timetodisplaynative.d.ts +17 -0
  80. package/ts3.8/dist/js/tracing/timetodisplaynative.types.d.ts +14 -0
  81. package/ts3.8/dist/js/tracing/utils.d.ts +8 -3
  82. package/ts3.8/dist/js/utils/sentryeventemitter.d.ts +24 -0
  83. package/ts3.8/dist/js/version.d.ts +1 -1
  84. package/ts3.8/dist/js/wrapper.d.ts +5 -0
@@ -12,9 +12,16 @@ interface ReactNavigationOptions {
12
12
  * before the transaction is discarded.
13
13
  * Time is in ms.
14
14
  *
15
- * Default: 1000
15
+ * @default 1000
16
16
  */
17
17
  routeChangeTimeoutMs: number;
18
+ /**
19
+ * Time to initial display measures the time it takes from
20
+ * navigation dispatch to the render of the first frame of the new screen.
21
+ *
22
+ * @default false
23
+ */
24
+ enableTimeToInitialDisplay: boolean;
18
25
  }
19
26
  /**
20
27
  * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.
@@ -28,9 +35,11 @@ export declare class ReactNavigationInstrumentation extends InternalRoutingInstr
28
35
  static instrumentationName: string;
29
36
  readonly name: string;
30
37
  private _navigationContainer;
38
+ private _newScreenFrameEventEmitter;
31
39
  private readonly _maxRecentRouteLen;
32
40
  private _latestRoute?;
33
41
  private _latestTransaction?;
42
+ private _navigationProcessingSpan?;
34
43
  private _initialStateHandled;
35
44
  private _stateChangeTimeout?;
36
45
  private _recentRouteKeys;
@@ -0,0 +1,46 @@
1
+ import type { Span, StartSpanOptions } from '@sentry/types';
2
+ import * as React from 'react';
3
+ /**
4
+ * Flags of active spans with manual initial display.
5
+ */
6
+ export declare const manualInitialDisplaySpans: WeakMap<Span, true>;
7
+ export type TimeToDisplayProps = {
8
+ children?: React.ReactNode;
9
+ spanName?: string;
10
+ record?: boolean;
11
+ };
12
+ /**
13
+ * Component to measure time to initial display.
14
+ *
15
+ * The initial display is recorded when the component prop `record` is true.
16
+ *
17
+ * <TimeToInitialDisplay record />
18
+ */
19
+ export declare function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement;
20
+ /**
21
+ * Component to measure time to full display.
22
+ *
23
+ * The initial display is recorded when the component prop `record` is true.
24
+ *
25
+ * <TimeToInitialDisplay record />
26
+ */
27
+ export declare function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement;
28
+ /**
29
+ * Starts a new span for the initial display.
30
+ *
31
+ * Returns current span if already exists in the currently active span.
32
+ */
33
+ export declare function startTimeToInitialDisplaySpan(options?: Exclude<StartSpanOptions, 'op' | 'name'> & {
34
+ name?: string;
35
+ isAutoInstrumented?: boolean;
36
+ }): Span | undefined;
37
+ /**
38
+ * Starts a new span for the full display.
39
+ *
40
+ * Returns current span if already exists in the currently active span.
41
+ */
42
+ export declare function startTimeToFullDisplaySpan(options?: Omit<StartSpanOptions, 'op' | 'name'> & {
43
+ name?: string;
44
+ timeoutMs?: number;
45
+ }): Span | undefined;
46
+ //# sourceMappingURL=timetodisplay.d.ts.map
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import type { HostComponent } from 'react-native';
3
+ import type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';
4
+ export declare const nativeComponentExists: boolean;
5
+ /**
6
+ * This is a fallback component for environments where the native component is not available.
7
+ */
8
+ declare class RNSentryOnDrawReporterNoop extends React.Component<RNSentryOnDrawReporterProps> {
9
+ render(): React.ReactNode;
10
+ }
11
+ declare let RNSentryOnDrawReporter: HostComponent<RNSentryOnDrawReporterProps> | typeof RNSentryOnDrawReporterNoop;
12
+ /**
13
+ * Native component that reports the on draw timestamp.
14
+ */
15
+ export declare const getRNSentryOnDrawReporter: () => typeof RNSentryOnDrawReporter;
16
+ export {};
17
+ //# sourceMappingURL=timetodisplaynative.d.ts.map
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export interface RNSentryOnDrawNextFrameEvent {
3
+ newFrameTimestampInSeconds: number;
4
+ type: 'initialDisplay' | 'fullDisplay';
5
+ }
6
+ export interface RNSentryOnDrawReporterProps {
7
+ children?: React.ReactNode;
8
+ onDrawNextFrame: (event: {
9
+ nativeEvent: RNSentryOnDrawNextFrameEvent;
10
+ }) => void;
11
+ initialDisplay?: boolean;
12
+ fullDisplay?: boolean;
13
+ }
14
+ //# sourceMappingURL=timetodisplaynative.types.d.ts.map
@@ -1,5 +1,5 @@
1
- import type { IdleTransaction, Span, Transaction } from '@sentry/core';
2
- import type { TransactionContext, TransactionSource } from '@sentry/types';
1
+ import type { IdleTransaction, Span as SpanClass, Transaction } from '@sentry/core';
2
+ import type { Span, TransactionContext, TransactionSource } from '@sentry/types';
3
3
  export declare const defaultTransactionSource: TransactionSource;
4
4
  export declare const customTransactionSource: TransactionSource;
5
5
  export declare const getBlankTransactionContext: (name: string) => TransactionContext;
@@ -19,9 +19,14 @@ export declare function getTimeOriginMilliseconds(): number;
19
19
  /**
20
20
  * Calls the callback every time a child span of the transaction is finished.
21
21
  */
22
- export declare function instrumentChildSpanFinish(transaction: Transaction, callback: (span: Span, endTimestamp?: number) => void): void;
22
+ export declare function instrumentChildSpanFinish(transaction: Transaction, callback: (span: SpanClass, endTimestamp?: number) => void): void;
23
23
  /**
24
24
  * Determines if the timestamp is now or within the specified margin of error from now.
25
25
  */
26
26
  export declare function isNearToNow(timestamp: number): boolean;
27
+ /**
28
+ * Sets the duration of the span as a measurement.
29
+ * Uses `setMeasurement` function from @sentry/core.
30
+ */
31
+ export declare function setSpanDurationAsMeasurement(name: string, span: Span): void;
27
32
  //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,24 @@
1
+ import type { NativeModule } from 'react-native';
2
+ import { NativeEventEmitter } from 'react-native';
3
+ export declare const NewFrameEventName = "rn_sentry_new_frame";
4
+ export type NewFrameEventName = typeof NewFrameEventName;
5
+ export type NewFrameEvent = {
6
+ newFrameTimestampInSeconds: number;
7
+ };
8
+ export interface SentryEventEmitter {
9
+ /**
10
+ * Initializes the native event emitter
11
+ * This method is synchronous in JS but the native event emitter starts asynchronously
12
+ * https://github.com/facebook/react-native/blob/d09c02f9e2d468e4d0bde51890e312ae7003a3e6/packages/react-native/React/Modules/RCTEventEmitter.m#L95
13
+ */
14
+ initAsync: (eventType: NewFrameEventName) => void;
15
+ closeAllAsync: () => void;
16
+ addListener: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;
17
+ removeListener: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;
18
+ once: (eventType: NewFrameEventName, listener: (event: NewFrameEvent) => void) => void;
19
+ }
20
+ /**
21
+ * Creates emitter that allows to listen to native RNSentry events
22
+ */
23
+ export declare function createSentryEventEmitter(sentryNativeModule?: NativeModule | undefined, createNativeEventEmitter?: (nativeModule: NativeModule | undefined) => NativeEventEmitter): SentryEventEmitter;
24
+ //# sourceMappingURL=sentryeventemitter.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.19.3";
3
+ export declare const SDK_VERSION = "5.20.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -4,6 +4,10 @@ import type { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFrames
4
4
  import type { ReactNativeClientOptions } from './options';
5
5
  import type * as Hermes from './profiling/hermes';
6
6
  import type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';
7
+ /**
8
+ * Returns the RNSentry module. Dynamically resolves if NativeModule or TurboModule is used.
9
+ */
10
+ export declare function getRNSentryModule(): Spec | undefined;
7
11
  export interface Screenshot {
8
12
  data: Uint8Array;
9
13
  contentType: string;
@@ -58,6 +62,7 @@ interface SentryNativeWrapper {
58
62
  * Fetches native stack frames and debug images for the instructions addresses.
59
63
  */
60
64
  fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;
65
+ initNativeReactNavigationNewFrameTracking(): Promise<void>;
61
66
  }
62
67
  /**
63
68
  * Our internal interface for calling native functions