Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions includes/react-native-react-navigation-setup.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Manual Setup

```jsx {5, 20} {tabTitle: Functional Components}
import * as Sentry from "@sentry/react-native";
import { NavigationContainer, createNavigationContainerRef } from "@react-navigation/native";
Expand Down Expand Up @@ -53,3 +55,28 @@ class App extends React.Component {
}
}
```

### With Sentry.NavigationContainer

`Sentry.NavigationContainer` is a drop-in replacement for React Navigation's `NavigationContainer` that handles registration automatically. It accepts all the same props, including `ref` for imperative navigation.

```jsx
import * as Sentry from "@sentry/react-native";

Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [
Sentry.reactNavigationIntegration({
enableTimeToInitialDisplay: true,
}),
],
});

function App() {
return (
<Sentry.NavigationContainer>
{/* Your navigation structure */}
</Sentry.NavigationContainer>
);
}
```
Loading