### Install and Run macOS Sample Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Navigates to the macOS sample directory, installs dependencies including Ruby gems, installs pods, starts the Metro server, and runs the macOS application. ```bash cd samples/react-native-macos/ yarn bundle install yarn pod-install-legacy yarn start yarn react-native run-macos ``` -------------------------------- ### Install and Build React Native Sample Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Navigates to the React Native sample directory, starts the Metro development server, installs native dependencies, and builds the iOS and Android applications. ```bash cd samples/react-native/ yarn start # Metro development server npx pod-install yarn ios # iOS Development build yarn android # Android Development build ``` -------------------------------- ### Install and Build Project Source: https://github.com/getsentry/sentry-react-native/blob/main/CLAUDE.md Installs project dependencies and builds all packages. ```bash yarn install yarn build ``` -------------------------------- ### Install Dependencies and Build Project Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Installs all project dependencies and performs an initial build. This is a prerequisite for running other commands. ```bash $ yarn $ yarn build ``` -------------------------------- ### Start Expo App Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/expo/AGENTS.md Use this command to start the Expo development server. Follow the prompts to open the app on your simulator or device. ```bash yarn start ``` -------------------------------- ### Start Metro Bundler and Run Apps Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/AGENTS.md Commands to start the Metro bundler and run the React Native application on iOS and Android. ```bash yarn start # Start Metro bundler yarn ios # Run iOS app (separate terminal) yarn android # Run Android app (separate terminal) ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/getsentry/sentry-react-native/blob/main/CLAUDE.md Examples of conventional commit messages for different types and scopes. ```git feat(replay): Add mobile replay masking support fix(android): Fix crash on startup with Hermes ``` -------------------------------- ### Install Sentry SDK with Wizard Source: https://github.com/getsentry/sentry-react-native/blob/main/README.md Use the Sentry wizard to automatically install and configure the SDK for your React Native project. ```sh npx @sentry/wizard -s -i reactNative ``` -------------------------------- ### startSpan Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Starts a new span for performance monitoring. ```APIDOC ## startSpan ### Description Starts a new span for performance monitoring. ### Signature ```typescript function startSpan(options: StartSpanOptions): Span; ``` ### Parameters - **options** (StartSpanOptions) - Required - Options for creating the span. ``` -------------------------------- ### Alternative CLI Invocation Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/expo-upload-sourcemaps/README.md If you have @sentry/react-native installed, you can invoke the same CLI tool using a different command. The scoped form is recommended for new setups. ```bash npx @sentry/expo-upload-sourcemaps dist ``` ```bash npx sentry-expo-upload-sourcemaps dist ``` -------------------------------- ### startSpanManual Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Starts a new span manually, allowing for custom control over its lifecycle. ```APIDOC ## startSpanManual ### Description Starts a new span manually. ### Signature ```typescript function startSpanManual(options: StartSpanOptions): Span; ``` ### Parameters - **options** (StartSpanOptions) - Required - Options for creating the span. ``` -------------------------------- ### Initialize Sentry SDK and Capture Message Source: https://github.com/getsentry/sentry-react-native/blob/main/README.md Basic setup for Sentry in a React Native application. Includes DSN configuration, performance tracing, and capturing a simple message. Ensure you replace '__DSN__' with your actual DSN. ```javascript import * as Sentry from "@sentry/react-native"; Sentry.init({ dsn: "__DSN__", // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production tracesSampleRate: 1.0, }); Sentry.setTag("myTag", "tag-value"); Sentry.setExtra("myExtra", "extra-value"); Sentry.addBreadcrumb({ message: "test" }); Sentry.captureMessage("Hello Sentry!"); ``` -------------------------------- ### startIdleNavigationSpan Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Starts an idle span for navigation, useful for tracking the time spent in navigation states. ```APIDOC ## startIdleNavigationSpan ### Description Starts an idle span for navigation. ### Signature ```typescript const startIdleNavigationSpan: (startSpanOption: StartSpanOptions, input?: Partial & { isAppRestart?: boolean }) => Span | undefined; ``` ### Parameters - **startSpanOption** (StartSpanOptions) - Required - Options for starting the span. - **input** (object) - Optional - Additional options for the idle span. - **isAppRestart** (boolean) - Optional - Indicates if the navigation is part of an application restart. ``` -------------------------------- ### startIdleSpan Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Starts an idle span with a specified final timeout and idle timeout. ```APIDOC ## startIdleSpan ### Description Starts an idle span with specified timeouts. ### Signature ```typescript const startIdleSpan: (startSpanOption: StartSpanOptions, input: { finalTimeout: number | undefined, idleTimeout: number | undefined }) => Span; ``` ### Parameters - **startSpanOption** (StartSpanOptions) - Required - Options for starting the span. - **input** (object) - Required - Timeout configurations for the idle span. - **finalTimeout** (number | undefined) - The final timeout for the span. - **idleTimeout** (number | undefined) - The idle timeout for the span. ``` -------------------------------- ### startTimeToInitialDisplaySpan Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Starts a span to measure the time until the initial content is displayed. This method is deprecated. ```APIDOC ## startTimeToInitialDisplaySpan ### Description Starts a span to measure the time until the initial content is displayed. This method is deprecated. ### Signature ```typescript function startTimeToInitialDisplaySpan(options?: Omit & { name?: string, isAutoInstrumented?: boolean }): Span | undefined; ``` ### Parameters - **options** (object) - Optional - Configuration options for the span. - **name** (string) - Optional - The name of the span. - **isAutoInstrumented** (boolean) - Optional - Indicates if the span is auto-instrumented. ``` -------------------------------- ### Jest Test Structure with Describe/It Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/AGENTS.md Example of structuring a test using describe and it blocks with Arrange-Act-Assert pattern. ```typescript describe('functionName', () => { it('returns expected value when input is valid', () => { // Arrange const input = 'test'; // Act const result = functionName(input); // Assert expect(result).toBe('expected'); }); }); ``` -------------------------------- ### startTimeToFullDisplaySpan Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Starts a span to measure the time until the full content is displayed. This method is deprecated. ```APIDOC ## startTimeToFullDisplaySpan ### Description Starts a span to measure the time until the full content is displayed. This method is deprecated. ### Signature ```typescript function startTimeToFullDisplaySpan(options?: Omit & { name?: string, timeoutMs?: number, isAutoInstrumented?: boolean }): Span | undefined; ``` ### Parameters - **options** (object) - Optional - Configuration options for the span. - **name** (string) - Optional - The name of the span. - **timeoutMs** (number) - Optional - The timeout in milliseconds for the span. - **isAutoInstrumented** (boolean) - Optional - Indicates if the span is auto-instrumented. ``` -------------------------------- ### Jest Matchers Examples Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/AGENTS.md Demonstrates preferred specific Jest matchers for assertions and contrasts them with less ideal comparisons. ```typescript // Good expect(value).toBe(true); expect(array).toHaveLength(3); expect(object).toMatchObject({ key: 'value' }); expect(fn).toThrow(Error); expect(promise).resolves.toBe('success'); // Avoid expect(value === true).toBe(true); expect(array.length).toBe(3); ``` -------------------------------- ### Full Pod Refresh for iOS Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/AGENTS.md Command to perform a full refresh of CocoaPods dependencies by updating the repository and installing. ```bash cd ios && pod install --repo-update ``` -------------------------------- ### getDefaultIdleNavigationSpanOptions Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Gets the default options for idle navigation spans. ```APIDOC ## Function: getDefaultIdleNavigationSpanOptions ### Description Gets the default options for idle navigation spans. Returns `StartSpanOptions`. ``` -------------------------------- ### Ready-to-merge Gate Job Configuration Source: https://github.com/getsentry/sentry-react-native/blob/main/CI.md This job should be added at the start of a workflow to gate other jobs. It checks for the 'ready-to-merge' label on pull requests. ```yaml ready-to-merge-gate: name: Ready-to-merge gate uses: ./.github/workflows/ready-to-merge-workflow.yml with: is-pr: ${{ github.event_name == 'pull_request' }} labels: ${{ toJson(github.event.pull_request.labels) }} ``` -------------------------------- ### Objective-C Native Bridge Pattern Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/ios/AGENTS.md Example of exporting a native Objective-C method to be called from React Native. Handles success and failure using promise resolve and reject blocks. ```objective-c RCT_EXPORT_METHOD(nativeOperation:(NSString *)param resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { @try { BOOL result = [self performOperation:param]; resolve(@(result)); } @catch (NSException *exception) { reject(@"OPERATION_FAILED", exception.reason, nil); } } ``` -------------------------------- ### Java Native Bridge Operation Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/android/AGENTS.md Example of a Java method exposed to React Native using the Native Bridge pattern. It demonstrates handling parameters and resolving or rejecting promises. ```java @ReactMethod public void nativeOperation(String param, Promise promise) { try { boolean result = performOperation(param); promise.resolve(result); } catch (Exception e) { promise.reject("OPERATION_FAILED", "Operation failed: " + e.getMessage(), e); } } ``` -------------------------------- ### Set Up Sentry CLI Token for Samples Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Configures the Sentry CLI authentication token by creating a .env file in the root of each sample project. ```bash SENTRY_AUTH_TOKEN=... ``` -------------------------------- ### Build and Test Commands Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/AGENTS.md Commands for building and testing the SDK in watch mode or for specific test suites. ```bash yarn build:sdk:watch # Watch mode for development yarn test:watch # Jest watch mode yarn test:sdk # SDK tests only yarn test:tools # Tools tests only ``` -------------------------------- ### Build and Publish sentry-java Locally Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Builds the sentry-java library and publishes it to the local Maven repository. Verify the publication by checking the expected directory. ```sh cd sentry-java make dryRelease ls ~/.m2/repository/io/sentry/sentry-android # check that `sentry-java` was published ``` -------------------------------- ### Build sentry-cocoa Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Initializes and builds the sentry-cocoa native library. ```bash cd sentry-cocoa make init ``` -------------------------------- ### Run iOS/Android Emulators (New Architecture) Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Builds and runs the React Native sample on iOS and Android emulators using the new architecture. Includes commands for production release builds. ```bash yarn pod-install yarn react-native run-ios yarn react-native run-android # Release builds yarn pod-install-production yarn react-native run-ios --mode=Release yarn react-native run-android --mode=Release ``` -------------------------------- ### Run iOS/Android Emulators (Legacy Architecture) Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Builds and runs the React Native sample on iOS and Android emulators using the legacy architecture. Includes commands for production release builds. ```bash yarn pod-install-legacy yarn react-native run-ios yarn react-native run-android # Release builds yarn pod-install-legacy-production yarn react-native run-ios --mode=Release yarn react-native run-android --mode=release ``` -------------------------------- ### Build SDK in Watch Mode Source: https://github.com/getsentry/sentry-react-native/blob/main/CLAUDE.md Builds the core SDK package and watches for changes. ```bash cd packages/core && yarn build:sdk:watch ``` -------------------------------- ### init Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the Sentry SDK for the React Native application. ```APIDOC ## Function: init ### Description Initializes the Sentry SDK with the provided options. ### Parameters - `passedOptions` (ReactNativeOptions) - The options to configure the Sentry SDK. ### Returns - `void` ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/tm/CMakeLists.txt Sets the minimum CMake version and enables verbose makefile output for debugging. ```cmake cmake_minimum_required(VERSION 3.13) set(CMAKE_VERBOSE_MAKEFILE on) ``` -------------------------------- ### Add Local Maven Repository Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Configures the sample project to use the local Maven repository, which is necessary for testing local builds of sentry-java. ```gradle allprojects { repositories { mavenLocal() } } ``` -------------------------------- ### Clear Node Modules and Reinstall Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/AGENTS.md Command to resolve general build failures by clearing the node_modules directory and reinstalling dependencies. ```bash rm -rf node_modules && yarn install ``` -------------------------------- ### Troubleshoot Build Failures Source: https://github.com/getsentry/sentry-react-native/blob/main/CLAUDE.md Commands to clear dependencies and rebuild the project to resolve build issues. ```bash rm -rf node_modules && yarn install yarn clean && yarn build ``` -------------------------------- ### spotlightIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the Spotlight integration for Sentry React Native. ```APIDOC ## spotlightIntegration ### Description Initializes the Spotlight integration for Sentry React Native. ### Signature ```typescript function spotlightIntegration(input?: SpotlightReactNativeIntegrationOptions): Integration; ``` ### Parameters - **input** (SpotlightReactNativeIntegrationOptions) - Optional - Configuration options for the Spotlight integration. ``` -------------------------------- ### mobileReplayIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the mobile replay integration for capturing user sessions and replaying them. ```APIDOC ## Function: mobileReplayIntegration ### Description Sets up the mobile replay integration for session recording. ### Parameters - `initOptions?` (MobileReplayOptions) - Optional initialization options for the mobile replay. ### Returns - `MobileReplayIntegration` - The configured mobile replay integration. ``` -------------------------------- ### appLoaded Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Marks the application as loaded. This is typically called after the application has finished its initial startup sequence. ```APIDOC ## appLoaded ### Description Marks the application as loaded. This is typically called after the application has finished its initial startup sequence. ### Signature ```typescript appLoaded(): void ``` ``` -------------------------------- ### Basic CMakeLists.txt Configuration Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/android/app/src/main/jni/CMakeLists.txt Defines the minimum required CMake version, sets the project name, and includes necessary React Native build utilities for the New Architecture. ```cmake cmake_minimum_required(VERSION 3.13) # Define the library name here. project(appmodules) # This file includes all the necessary to let you build your application with the New Architecture. include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake) ``` -------------------------------- ### Local sentry-cocoa Podfile Integration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/ios/AGENTS.md Instructions for integrating a local build of sentry-cocoa into a React Native project's Podfile. Requires building sentry-cocoa first. ```ruby pod 'Sentry/HybridSDK', :path => '../../../../sentry-cocoa' ``` -------------------------------- ### graphqlIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the GraphQL integration for Sentry, capturing GraphQL-related errors and performance data. ```APIDOC ## Function: graphqlIntegration ### Description Sets up the GraphQL integration for Sentry. ### Parameters - `options` (GraphQLReactNativeIntegrationOptions) - Configuration options for the GraphQL integration. ### Returns - `Integration` - The configured GraphQL integration. ``` -------------------------------- ### Configure sentry-android-gradle-plugin for Local Development Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Integrates the local `sentry-android-gradle-plugin` into the sample project's `settings.gradle` to enable debugging of the Gradle build process. ```groovy includeBuild('../../../../sentry-android-gradle-plugin/plugin-build') { dependencySubstitution { substitute(module 'io.sentry:sentry-android-gradle-plugin') using project(':') } } ``` -------------------------------- ### createTimeToInitialDisplay Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Creates a React component that measures the time to initial display, utilizing `useFocusEffect` for lifecycle management. ```APIDOC ## createTimeToInitialDisplay ### Description Creates a React component that measures the time to initial display, utilizing `useFocusEffect` for lifecycle management. ### Signature ```typescript createTimeToInitialDisplay(input: { useFocusEffect: (callback: () => void) => void; }): React.ComponentType ``` ``` -------------------------------- ### Generate API Report Source: https://github.com/getsentry/sentry-react-native/blob/main/CLAUDE.md Generates an API report for the core SDK package. ```bash cd packages/core && yarn api-report:check ``` -------------------------------- ### Compiler Options Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/tm/CMakeLists.txt Adds standard C++17 compiler flags for exceptions, RTTI, and language standard. ```cmake add_compile_options( -fexceptions -frtti -std=c++17) ``` -------------------------------- ### createTimeToFullDisplay Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Creates a React component that measures the time to full display, utilizing `useFocusEffect` for lifecycle management. ```APIDOC ## createTimeToFullDisplay ### Description Creates a React component that measures the time to full display, utilizing `useFocusEffect` for lifecycle management. ### Signature ```typescript createTimeToFullDisplay(input: { useFocusEffect: (callback: () => void) => void; }): React.ComponentType ``` ``` -------------------------------- ### Include Directories Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/tm/CMakeLists.txt Specifies public include directories for the 'tm' and 'react_codegen_AppSpecs' targets. ```cmake target_include_directories(tm PUBLIC .) target_include_directories(react_codegen_AppSpecs PUBLIC .) ``` -------------------------------- ### Watch Mode for SDK Core Development Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Enables watch mode for the core SDK package, allowing for continuous development and automatic rebuilding on changes. ```bash cd packages/core yarn build:sdk:watch ``` -------------------------------- ### supabaseIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the Supabase integration for Sentry React Native. ```APIDOC ## supabaseIntegration ### Description Initializes the Supabase integration for Sentry React Native. ### Signature ```typescript function supabaseIntegration(options: SupabaseReactNativeIntegrationOptions): Integration; ``` ### Parameters - **options** (SupabaseReactNativeIntegrationOptions) - Required - Configuration options for the Supabase integration. ``` -------------------------------- ### modulesLoaderIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides an integration for loading Sentry modules. ```APIDOC ## Function: modulesLoaderIntegration ### Description Returns an integration for loading Sentry modules. ### Returns - `Integration` - The modules loader integration. ``` -------------------------------- ### stallTrackingIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the stall tracking integration for Sentry React Native, which monitors application performance stalls. ```APIDOC ## stallTrackingIntegration ### Description Initializes the stall tracking integration for Sentry React Native. ### Signature ```typescript const stallTrackingIntegration: (input?: { minimumStallThresholdMs?: number }) => Integration; ``` ### Parameters - **input** (object) - Optional - Configuration options for stall tracking. - **minimumStallThresholdMs** (number) - Optional - The minimum duration in milliseconds to consider an event a stall. ``` -------------------------------- ### Library Definition and Source Inclusion Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/tm/CMakeLists.txt Defines a static library named 'tm' and includes all .cpp files from the current directory. ```cmake file(GLOB tm_SRC CONFIGURE_DEPENDS *.cpp) add_library(tm STATIC ${tm_SRC}) ``` -------------------------------- ### nativeFramesIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides an integration for capturing native frames, useful for performance monitoring. ```APIDOC ## Function: nativeFramesIntegration ### Description Returns an integration for capturing native frames. ### Returns - `Integration` - The native frames integration. ``` -------------------------------- ### Update sentry-android Version in Sample Project Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Modifies the `sentry-android` dependency in the sample project's `android/build.gradle` to point to the locally published version. ```diff dependencies { implementation 'com.facebook.react:react-native:+' - api 'io.sentry:sentry-android:5.4.0' + api 'io.sentry:sentry-android:6.7.7-my-local-version' } ``` -------------------------------- ### Run Gradle Build with Debugging Enabled Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Executes a Gradle build command with specific flags to enable remote JVM debugging, allowing for debugging of the `sentry-android-gradle-plugin`. ```groovy ./gradlew assembleRelease -Dorg.gradle.debug=true --no-daemon ``` -------------------------------- ### Clean Gradle Build for Android Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/AGENTS.md Command to clean the Gradle build cache for the Android application. ```bash cd android && ./gradlew clean ``` -------------------------------- ### Troubleshoot Test Failures Source: https://github.com/getsentry/sentry-react-native/blob/main/CLAUDE.md Commands to clear the Jest cache and ensure the build is up to date. ```bash jest --clearCache yarn build ``` -------------------------------- ### Customizing CMakeLists.txt for React Native Android Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/android/app/src/main/jni/CMakeLists.txt Instructions on how to copy and extend the default CMakeLists.txt and OnLoad.cpp files for custom C++ linking or compilation flags in your React Native Android project. ```plaintext 1. Copy this CMake file inside the `android/app/src/main/jni` folder of your project 2. Copy the OnLoad.cpp (in this same folder) file inside the same folder as above. 3. Extend your `android/app/build.gradle` as follows android { // Other config here... externalNativeBuild { cmake { path "src/main/jni/CMakeLists.txt" } } } ``` -------------------------------- ### createReactNativeRewriteFrames Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Creates an integration that rewrites frames in stack traces for React Native environments. ```APIDOC ## createReactNativeRewriteFrames ### Description Creates an integration that rewrites frames in stack traces for React Native environments. ### Signature ```typescript createReactNativeRewriteFrames(): Integration ``` ``` -------------------------------- ### Run Tests and Watcher Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Executes all project tests or runs the test watcher for iterative test development. ```bash yarn test # Or the watcher when writing tests: cd packages/core yarn test:watch ``` -------------------------------- ### Update Public API Report Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Rebuilds the SDK and generates an API report. This command should be run when public API changes are made to update the baseline report. ```bash yarn build:sdk yarn api-report ``` -------------------------------- ### NavigationTheme Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Defines the theme structure for Sentry's navigation components. ```APIDOC ## Interface: NavigationTheme ### Description Defines the structure for theming navigation components. ### Properties - `colors` (object) - Color palette for navigation elements. - `primary` (string) - `background` (string) - `card` (string) - `text` (string) - `border` (string) - `notification` (string) - `dark` (boolean) - Indicates if the theme is dark. - `fonts` (object) - Font styles for navigation text. - `regular` (FontStyle) - `medium` (FontStyle) - `bold` (FontStyle) - `heavy` (FontStyle) ``` -------------------------------- ### Upload Source Maps with Auth Token Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/expo-upload-sourcemaps/README.md Use this command to upload source maps from your Expo build directory to Sentry. Ensure you have your Sentry authentication token set. ```bash SENTRY_AUTH_TOKEN= \ npx @sentry/expo-upload-sourcemaps dist ``` -------------------------------- ### NativeLogEntry Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Interface representing a log entry captured from the native side. ```APIDOC ## Interface: NativeLogEntry ### Description Represents a log entry from the native environment. ### Properties - `component` (string) - The component associated with the log entry. - `level` (string) - The log level (e.g., 'info', 'warn', 'error'). - `message` (string) - The log message content. ``` -------------------------------- ### Utility Functions Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides utility functions for interacting with Sentry's React Native SDK. ```APIDOC ## Utility Functions ### resumeAppHangTracking #### Description Resumes the tracking of application hang states. This function is typically used after manually pausing tracking. #### Signature ```typescript () => void ``` ``` -------------------------------- ### feedbackIntegration Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the feedback integration for Sentry, allowing users to report issues. ```APIDOC ## Function: feedbackIntegration ### Description Initializes the feedback integration for Sentry, allowing users to report issues. This integration can be configured with various options for buttons, themes, and shake-to-report functionality. ### Parameters - **initOptions?**: Optional initialization options, including `buttonOptions`, `screenshotButtonOptions`, `colorScheme`, `themeLight`, `themeDark`, and `enableShakeToReport`. ``` -------------------------------- ### showFeedbackForm Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Displays the Sentry feedback form. ```APIDOC ## showFeedbackForm ### Description Displays the Sentry feedback form. ### Signature ```typescript function showFeedbackForm(): void; ``` ``` -------------------------------- ### showFeedbackWidget Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Displays the Sentry feedback widget. This is an alias for showFeedbackForm. ```APIDOC ## showFeedbackWidget ### Description Displays the Sentry feedback widget. This is an alias for `showFeedbackForm`. ### Signature ```typescript function showFeedbackWidget(): void; ``` ``` -------------------------------- ### nativeReleaseIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides an integration for associating release information with events. ```APIDOC ## Function: nativeReleaseIntegration ### Description Returns an integration for managing release information. ### Returns - `Integration` - The native release integration. ``` -------------------------------- ### wrap Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function to wrap the root React component of a React Native application, enabling Sentry's performance monitoring and error tracking from the application's entry point. ```APIDOC ## wrap ### Description Wraps the root React component of your React Native application with Sentry's SDK. This is typically done at the entry point of your application to enable comprehensive error tracking and performance monitoring. ### Usage ```javascript import { wrap } from '@sentry/react-native'; import App from './App'; const SentryWrappedApp = wrap(App, { // options }); export default SentryWrappedApp; ``` ### Parameters - `RootComponent` (React.ComponentType

): The root component of your application. - `options` (ReactNativeWrapperOptions, optional): Options for configuring the Sentry wrapper. ``` -------------------------------- ### setTags Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Sets multiple tags for the current scope. ```APIDOC ## setTags ### Description Sets multiple tags for the current scope. ### Signature ```typescript function setTags(tags: { [key: string]: string }): void; ``` ### Parameters - **tags** (object) - Required - An object containing key-value pairs of tags. ``` -------------------------------- ### Library Linking Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/tm/CMakeLists.txt Links the 'tm' library with necessary dependencies: jsi, react_nativemodule_core, and react_codegen_AppSpecs. ```cmake target_link_libraries(tm jsi react_nativemodule_core react_codegen_AppSpecs) ``` -------------------------------- ### ReactNativeClient Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md The main client class for Sentry in React Native applications. It provides methods for initializing the SDK, capturing events, and managing client state. ```APIDOC ## Class: ReactNativeClient ### Description Represents the Sentry client for React Native applications. It allows for initialization, event capturing, and other client-specific operations. ### Methods #### constructor(options: ReactNativeClientOptions) Initializes the React Native client with the provided options. #### captureUserFeedback(feedback: UserFeedback): void Captures and sends user feedback to Sentry. Deprecated. #### close(): PromiseLike Closes the Sentry client, ensuring all pending events are sent. #### emit(hook: string, ...rest: unknown[]): void Emits a hook with the given name and arguments. #### eventFromException(exception: unknown, hint?: EventHint): PromiseLike Creates an event object from a given exception. #### eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike Creates an event object from a given message. #### init(): void Initializes the Sentry SDK. This method should be called early in your application's lifecycle. #### nativeCrash(): void Triggers a native crash for testing purposes. #### on(hook: string, callback: unknown): () => void Registers a callback function to be executed when a specific hook is emitted. #### sendEnvelope(envelope: Envelope): PromiseLike Sends a Sentry envelope to the configured transport. ``` -------------------------------- ### Reinstall Pods for iOS Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/AGENTS.md Command to reinstall CocoaPods dependencies for the iOS application. ```bash npx pod-install ``` -------------------------------- ### pushTurboModuleCall Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Adds a TurboModule call to the tracking stack for performance monitoring. ```APIDOC ## Function: pushTurboModuleCall ### Description Adds a TurboModule call to the internal tracking stack for performance monitoring. ### Parameters - `args` (object) - Arguments for the TurboModule call. - `name` (string) - The name of the TurboModule. - `method` (string) - The method being called. - `kind` ('sync' | 'async') - The type of the call (synchronous or asynchronous). - `scope?` (Scope) - Optional scope for the call. ### Returns - `number` - The ID assigned to the TurboModule call. ``` -------------------------------- ### ExpoRouter Interface Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Defines methods for interacting with the Expo Router for navigation and prefetching. ```APIDOC ## Interface: ExpoRouter ### Description Defines methods for interacting with the Expo Router for navigation and prefetching. ### Methods - **back()**: Navigates back in the router history. - **dismiss(count?: number)**: Dismisses the current view, optionally by a specified count. - **navigate(...args: unknown[])**: Navigates to a new route with provided arguments. - **prefetch(href: ExpoRouterHref)**: Prefetches a given route href. - **push(...args: unknown[])**: Pushes a new route onto the navigation stack with provided arguments. - **replace(...args: unknown[])**: Replaces the current route with a new one using provided arguments. ``` -------------------------------- ### ExpoImage Interface Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides methods for managing image caching and loading within an Expo environment. ```APIDOC ## Interface: ExpoImage ### Description Provides methods for managing image caching and loading within an Expo environment. ### Methods - **clearDiskCache()**: Clears the disk cache for images. Returns a promise that resolves to a boolean indicating success. - **clearMemoryCache()**: Clears the memory cache for images. Returns a promise that resolves to a boolean indicating success. - **loadAsync(source: ExpoImageSource | string | number, options?: ExpoImageLoadOptions)**: Loads an image from a given source with optional load options. Returns a promise that resolves to an ExpoImageRef. - **prefetch(urls: string | string[], cachePolicyOrOptions?: any)**: Prefetches one or more image URLs with an optional cache policy or options. Returns a promise that resolves to a boolean indicating success. ``` -------------------------------- ### timeToDisplayIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the time to display integration for Sentry React Native. ```APIDOC ## timeToDisplayIntegration ### Description Initializes the time to display integration for Sentry React Native. ### Signature ```typescript const timeToDisplayIntegration: () => Integration; ``` ``` -------------------------------- ### primitiveTagIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides an integration for adding primitive tags to events. ```APIDOC ## Function: primitiveTagIntegration ### Description Returns an integration that adds primitive tags to events. ### Returns - `Integration` - The primitive tag integration. ``` -------------------------------- ### Defining Additional Header Files in CMake Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/android/app/src/main/jni/CMakeLists.txt Specifies the directories where CMake can find additional header files for the native module, relative to the CMakeLists.txt file. ```cmake # Define where CMake can find the additional header files. We need to crawl back the jni, main, src, app, android folders target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC ../../../../../tm) ``` -------------------------------- ### nativeCrash Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Manually triggers a native crash for testing purposes. ```APIDOC ## Function: nativeCrash ### Description Triggers a native crash in the application for testing Sentry's crash reporting. ### Returns - `void` ``` -------------------------------- ### logEnricherIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides an integration to enrich logs with additional context. ```APIDOC ## Function: logEnricherIntegration ### Description Returns an integration that enriches log entries. ### Returns - `Integration` - The log enricher integration. ``` -------------------------------- ### wrapExpoAsset Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function to wrap Expo Asset classes, enabling Sentry to potentially track or instrument asset-related operations. ```APIDOC ## wrapExpoAsset ### Description Wraps an Expo Asset class with Sentry's instrumentation. This function is intended for use within Expo projects to ensure Sentry can monitor or interact with Expo's asset management. ### Usage ```javascript import { wrapExpoAsset } from '@sentry/react-native'; import { Asset } from 'expo-asset'; const SentryTrackedAsset = wrapExpoAsset(Asset); ``` ### Parameters - `assetClass` (T): The Expo Asset class to wrap. ``` -------------------------------- ### Integrations Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides various integration functions to enhance Sentry's functionality within a React Native environment. ```APIDOC ## Integrations ### reactNativeErrorHandlersIntegration #### Description An integration that automatically sets up error handlers for the React Native application. #### Signature ```typescript (options?: Partial) => Integration ``` ### reactNativeInfoIntegration #### Description An integration that automatically collects and sends device and application information. #### Signature ```typescript () => Integration ``` ### reactNativeNavigationIntegration #### Description An integration for tracking navigation events within React Native applications using a specific navigation library. #### Signature ```typescript (input: ReactNativeNavigationOptions) => Integration ``` ### reactNativeTracingIntegration #### Description An integration for enabling and configuring tracing in React Native applications. It provides options for customizing trace behavior and managing trace state. #### Signature ```typescript (options?: Partial) => Integration & { options: ReactNativeTracingOptions; state: ReactNativeTracingState; setCurrentRoute: (route: string) => void; } ``` ### reactNavigationIntegration #### Description An integration for tracking navigation events specifically with React Navigation. It allows for registering navigation containers and overriding route information. #### Signature ```typescript (input?: Partial) => Integration & { registerNavigationContainer: (navigationContainerRef: unknown) => void; _setRouteOverrideProvider: (provider: RouteOverrideProvider | undefined) => void; options: ReactNavigationIntegrationOptions; } ``` ### screenshotIntegration #### Description An integration that enables automatic screenshot capture for errors. #### Signature ```typescript () => Integration ``` ### sdkInfoIntegration #### Description An integration that collects and sends SDK information to Sentry. #### Signature ```typescript () => Integration ``` ``` -------------------------------- ### setTag Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Sets a tag for the current scope. ```APIDOC ## setTag ### Description Sets a tag for the current scope. ### Signature ```typescript function setTag(key: string, value: string): void; ``` ### Parameters - **key** (string) - Required - The key of the tag. - **value** (string) - Required - The value of the tag. ``` -------------------------------- ### expoUpdatesListenerIntegration Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Creates an integration to listen for Expo Updates events. ```APIDOC ## Function: expoUpdatesListenerIntegration ### Description Creates an integration to listen for Expo Updates events. ``` -------------------------------- ### wrapExpoRouter Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function to wrap Expo Router classes, enabling Sentry to track navigation events and errors within Expo applications using the Expo Router. ```APIDOC ## wrapExpoRouter ### Description Wraps Expo Router classes with Sentry's instrumentation. This allows Sentry to capture navigation events, route changes, and potential errors occurring within the Expo Router navigation system. ### Usage ```javascript import { wrapExpoRouter } from '@sentry/react-native'; import { router } from 'expo-router'; const SentryTrackedRouter = wrapExpoRouter(router); ``` ### Parameters - `router` (T): The Expo Router instance or class to wrap. ``` -------------------------------- ### hermesProfilingIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Provides an integration for Hermes profiling, enabling performance monitoring for the Hermes JavaScript engine. ```APIDOC ## Constant: hermesProfilingIntegration ### Description An integration for enabling Hermes profiling. ### Parameters - `initOptions?` (HermesProfilingOptions) - Optional initialization options for Hermes profiling. ### Returns - `Integration` - The Hermes profiling integration. ``` -------------------------------- ### sentryTraceGesture Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function to trace a gesture, allowing for performance monitoring of touch interactions. ```APIDOC ## sentryTraceGesture ### Description Traces a gesture with a given label for performance monitoring. ### Signature ```typescript function sentryTraceGesture(label: string, gesture: GestureT): GestureT; ``` ### Parameters - **label** (string) - Required - A label to identify the gesture in Sentry traces. - **gesture** (GestureT) - Required - The gesture object to be traced. ``` -------------------------------- ### setUser Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Sets the user for the current scope. ```APIDOC ## setUser ### Description Sets the user for the current scope. ### Signature ```typescript function setUser(user: User | null): void; ``` ### Parameters - **user** (User | null) - Optional - The user object to set, or null to clear the user. ``` -------------------------------- ### nativeLinkedErrorsIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Initializes the native linked errors integration to capture and link errors occurring in native code. ```APIDOC ## Function: nativeLinkedErrorsIntegration ### Description Sets up the integration for linking native errors. ### Parameters - `options?` (Partial) - Optional configuration for linking native errors. ### Returns - `Integration` - The native linked errors integration. ``` -------------------------------- ### TimeToInitialDisplay Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A React component that wraps content to measure the time until it is initially displayed. ```APIDOC ## TimeToInitialDisplay ### Description A React component that wraps content to measure the time until it is initially displayed. ### Signature ```typescript function TimeToInitialDisplay(props: TimeToDisplayProps): React_2.ReactElement; ``` ### Props - **props** (TimeToDisplayProps) - Required - Properties for the component. - **children** (React_2.ReactNode) - Optional - The content to be displayed. - **record** (boolean) - Optional - Whether to record the display time. - **ready** (boolean) - Optional - Indicates if the content is ready to be displayed. ``` -------------------------------- ### getDataFromUri Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Retrieves data from a given URI. ```APIDOC ## Function: getDataFromUri ### Description Retrieves data from a given URI. Returns a promise that resolves to a `Uint8Array` or `null`. ``` -------------------------------- ### wrapExpoImage Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function to wrap Expo Image classes, allowing Sentry to track or instrument image-related operations within an Expo application. ```APIDOC ## wrapExpoImage ### Description Wraps an Expo Image class with Sentry's instrumentation. This function is useful for applications using Expo's image handling capabilities, enabling Sentry to monitor image loading or display. ### Usage ```javascript import { wrapExpoImage } from '@sentry/react-native'; import { Image } from 'expo-image'; const SentryTrackedImage = wrapExpoImage(Image); ``` ### Parameters - `imageClass` (T): The Expo Image class to wrap. ``` -------------------------------- ### NavigationContainer Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A Sentry-aware navigation container component for React Navigation. ```APIDOC ## Component: NavigationContainer ### Description A React component that wraps navigation to enable Sentry's navigation tracking. ### Props - `Omit & React_2.RefAttributes` - Props for the navigation container, excluding the ref attribute. ``` -------------------------------- ### Mocking Native Modules in Tests Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/AGENTS.md Configures Jest to mock the 'react-native' module, specifically providing a mock implementation for NativeModules.RNSentry and Platform.OS. ```typescript jest.mock('react-native', () => ({ NativeModules: { RNSentry: { nativeOperation: jest.fn(() => Promise.resolve(true)), }, }, Platform: { OS: 'ios', }, })); ``` -------------------------------- ### withScope Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function that allows executing a callback with a temporary scope, enabling modifications to the current Sentry scope that are isolated to the callback's execution. ```APIDOC ## withScope ### Description Executes a callback function within a temporary Sentry scope. Any modifications made to the scope within the callback are isolated to that execution and do not affect the global scope afterwards. ### Usage ```javascript import { withScope } from '@sentry/react-native'; withScope(scope => { scope.setTag('myTag', 'myValue'); scope.setUser({ email: 'test@example.com' }); // Perform operations that should use this temporary scope }); ``` ### Parameters - `callback` (function(scope: Scope): T): The function to execute with the temporary scope. It receives the `Scope` object as an argument and can return a value. ### Returns - `T | undefined`: The return value of the callback function, or undefined if the callback does not return a value. ``` -------------------------------- ### pauseAppHangTracking Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Pauses the application hang tracking mechanism. ```APIDOC ## Function: pauseAppHangTracking ### Description Stops the automatic tracking of application hangs. ### Returns - `void` ``` -------------------------------- ### wrapTurboModule Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md A utility function to wrap TurboModules, enabling Sentry to capture and report errors or performance metrics related to TurboModule interactions. ```APIDOC ## wrapTurboModule ### Description Wraps a TurboModule with Sentry's instrumentation. This allows Sentry to monitor calls made to the TurboModule, capturing errors and performance data associated with these native module interactions. ### Usage ```javascript import { wrapTurboModule } from '@sentry/react-native'; const wrappedMyModule = wrapTurboModule('MyModule', NativeModules.MyModule, { skip: ['internalMethod'] }); ``` ### Parameters - `name` (string): The name of the TurboModule. - `module` (object | null | undefined): The TurboModule instance or object. - `options` (object, optional): Options for wrapping the module, such as `skip` methods. ``` -------------------------------- ### Exclude sentry-android-replay from Android builds Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/android/replay-stubs/README.md This Gradle snippet excludes the sentry-android-replay module from subprojects. Use this to reduce the resulting bundle/apk size when the replay functionality is not needed at runtime. ```gradle subprojects { configurations.all { exclude group: 'io.sentry', module: 'sentry-android-replay' } } ``` -------------------------------- ### setExtras Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Sets multiple extra data fields for the current scope. ```APIDOC ## setExtras ### Description Sets multiple extra data fields for the current scope. ### Signature ```typescript function setExtras(extras: { [key: string]: unknown }): void; ``` ### Parameters - **extras** (object) - Required - An object containing key-value pairs of extra data. ``` -------------------------------- ### setCurrentClient Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Sets the current Sentry client for the application. ```APIDOC ## setCurrentClient ### Description Sets the current Sentry client for the application. ### Signature ```typescript function setCurrentClient(client: Client): void; ``` ### Parameters - **client** (Client) - Required - The Sentry client instance to set. ``` -------------------------------- ### showFeedbackButton Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Displays a feedback button in the UI. This is a deprecated method. ```APIDOC ## showFeedbackButton ### Description Displays a feedback button in the UI. This method is deprecated. ### Signature ```typescript function showFeedbackButton(): void; ``` ``` -------------------------------- ### Defining Additional Source Files in CMake Source: https://github.com/getsentry/sentry-react-native/blob/main/samples/react-native/android/app/src/main/jni/CMakeLists.txt Specifies the location of additional C++ source files for the native module, relative to the CMakeLists.txt file. ```cmake # Define where the additional source code lives. We need to crawl back the jni, main, src, app, android folders target_sources(${CMAKE_PROJECT_NAME} PRIVATE ../../../../../tm/NativeSampleModule.cpp) ``` -------------------------------- ### setContext Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Sets context data for the current scope, useful for adding additional information to Sentry events. ```APIDOC ## setContext ### Description Sets context data for the current scope. ### Signature ```typescript function setContext(key: string, value: { [key: string]: unknown }): void; ``` ### Parameters - **key** (string) - Required - The key for the context data. - **value** (object) - Required - The context data to set. ``` -------------------------------- ### getReactNativeTracingIntegration Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Retrieves the React Native tracing integration for a given Sentry client. ```APIDOC ## Function: getReactNativeTracingIntegration ### Description Retrieves the React Native tracing integration for a given Sentry client. Returns `ReactNativeTracingIntegration` or `undefined`. ``` -------------------------------- ### Objective-C Error Handling Pattern Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/ios/AGENTS.md Standard Objective-C pattern for handling errors returned from operations. Logs the error if the operation fails. ```objective-c NSError *error = nil; BOOL success = [self performOperation:&error]; if (!success) { [SentryLog logWithMessage:[NSString stringWithFormat:@"Operation failed: %@", error] andLevel:kSentryLevelError]; return fallback; } ``` -------------------------------- ### close Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Closes the Sentry SDK, ensuring all pending events are sent before shutting down. ```APIDOC ## close ### Description Closes the Sentry SDK, ensuring all pending events are sent before shutting down. ### Signature ```typescript close(): Promise ``` ``` -------------------------------- ### Link Local sentry-cocoa Build in sentry-react-native Source: https://github.com/getsentry/sentry-react-native/blob/main/CONTRIBUTING.md Modifies the RNSentry.podspec to remove a specific version dependency and updates the sample's Podfile to use a local path for the Sentry pod. ```diff - s.dependency 'Sentry', '7.31.0' + s.dependency 'Sentry' target 'sample' do # ... react native config pod 'Sentry', :path => '../../../../sentry-cocoa' # ... rest of the configuration end ``` -------------------------------- ### expoRouterIntegration Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Creates an integration for Expo Router to enable Sentry's automatic instrumentation. ```APIDOC ## Function: expoRouterIntegration ### Description Creates an integration for Expo Router to enable Sentry's automatic instrumentation. ### Parameters - **options? (ExpoRouterIntegrationOptions)**: Optional configuration options for the integration. ``` -------------------------------- ### turboModuleContextIntegration Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md An integration function that helps in capturing and reporting information related to TurboModule calls within a React Native application. ```APIDOC ## turboModuleContextIntegration ### Description An integration that provides context for TurboModule calls, allowing Sentry to capture details about synchronous and asynchronous module interactions. ### Usage ```javascript import { turboModuleContextIntegration } from '@sentry/react-native'; Sentry.init({ integrations: [ turboModuleContextIntegration({ modules: [ { name: 'MyModule', module: NativeModules.MyModule, skipMethods: ['privateMethod'] } ] }) ] }); ``` ### Options - `modules` (Array<{ name: string, module: object | null | undefined, skipMethods?: ReadonlyArray }>): An array of module configurations to integrate. ``` -------------------------------- ### getTurboModuleCallStack Function Source: https://github.com/getsentry/sentry-react-native/blob/main/packages/core/etc/sentry-react-native.api.md Retrieves the call stack of TurboModule calls. ```APIDOC ## Function: getTurboModuleCallStack ### Description Retrieves the call stack of TurboModule calls. Returns an array of `TurboModuleCall` objects. ```