Skip to content
Merged
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
33 changes: 33 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,34 @@ class App extends React.Component {
}
}
```

### With Sentry.NavigationContainer

Comment thread
antonis marked this conversation as resolved.
<Alert>

Available in SDK version `8.13.0` and above.

</Alert>

`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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth mentioning the SDK version that introduced this feature here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea Lucas 👍 Added with b20429e


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

Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [
Comment thread
antonis marked this conversation as resolved.
Sentry.reactNavigationIntegration({
enableTimeToInitialDisplay: true,
}),
],
});

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