Skip to content

Latest commit

 

History

History
55 lines (46 loc) · 1.27 KB

react-native-react-navigation-setup.mdx

File metadata and controls

55 lines (46 loc) · 1.27 KB
import * as Sentry from "@sentry/react-native";
import { NavigationContainer } from "@react-navigation/native";

const navigationIntegration = Sentry.reactNavigationIntegration({
  enableTimeToInitialDisplay: true,
});

Sentry.init({
  dsn: "___PUBLIC_DSN___",
  integrations: [navigationIntegration],
})

function App = () => {
  const containerRef = React.useRef();

  return (
    <NavigationContainer
      ref={containerRef}
      onReady={() => {
        navigationIntegration.registerNavigationContainer(containerRef);
      }}>
    </NavigationContainer>
  );
};
import * as Sentry from "@sentry/react-native";
import { NavigationContainer } from "@react-navigation/native";

const navigationIntegration = Sentry.reactNavigationIntegration({
  enableTimeToInitialDisplay: true,
});

Sentry.init({
  dsn: "___PUBLIC_DSN___",
  integrations: [navigationIntegration],
})

class App extends React.Component {
  containerRef = React.createRef();

  render() {
    return (
      <NavigationContainer
        ref={this.containerRef}
        onReady={() => {
          navigationIntegration.registerNavigationContainer(this.containerRef);
        }}>
      </NavigationContainer>
    );
  }
}