setupContent.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type {CodeSnippetTab} from 'sentry/views/insights/mobile/screenload/components/tabbedCodeSnippets';
  2. const swiftSetupSnippet = `// Step 1 - Enable Time to Full Display
  3. import Sentry
  4. SentrySDK.start { options in
  5. options.dsn = "<my-dsn-key>"
  6. options.enableTimeToFullDisplayTracing = true
  7. }
  8. // Step 2 - Call API when screen is fully drawn
  9. SentrySDK.reportFullyDisplayed()
  10. `;
  11. const kotlinSnippet = `<!--Step 1: Enable Time to Full Display in AndroidManifest.xml-->
  12. <application>
  13. <meta-data android:name="io.sentry.traces.time-to-full-display.enable" android:value="true" />
  14. </application>
  15. // Step 2 - Call API when screen is fully drawn
  16. import io.sentry.Sentry
  17. Sentry.reportFullyDisplayed()
  18. `;
  19. const reactNativeSnippet = `// Step 1 - Use TimeToFullDisplay Component
  20. import * as Sentry from '@sentry/react-native';
  21. <Sentry.TimeToFullDisplay record={false}>
  22. <MyView />
  23. </Sentry.TimeToFullDisplay>
  24. // Step 2 - Set \`record={true}\` when screen is to be fully drawn
  25. <Sentry.TimeToFullDisplay record={true} />
  26. `;
  27. export const SETUP_CONTENT: CodeSnippetTab[] = [
  28. {
  29. code: swiftSetupSnippet,
  30. label: 'Swift',
  31. language: 'swift',
  32. value: 'swift',
  33. },
  34. {
  35. code: kotlinSnippet,
  36. label: 'Kotlin',
  37. language: 'unknown',
  38. value: 'kotlin',
  39. },
  40. {
  41. code: reactNativeSnippet,
  42. label: 'React Native',
  43. language: 'jsx',
  44. value: 'react-native',
  45. },
  46. ];