diff --git a/test/react-native/features/fixtures/app/dynamic/react-native-navigation/index.js b/test/react-native/features/fixtures/app/dynamic/react-native-navigation/index.js index 8cd2d72b3..ea1179e5d 100644 --- a/test/react-native/features/fixtures/app/dynamic/react-native-navigation/index.js +++ b/test/react-native/features/fixtures/app/dynamic/react-native-navigation/index.js @@ -2,12 +2,9 @@ import { Navigation } from 'react-native-navigation' import { View, Text, SafeAreaView, StyleSheet } from 'react-native' import React, { useEffect } from 'react' import { launchScenario } from '@bugsnag/react-native-scenarios' -import Bugsnag from '@bugsnag/react-native' console.reportErrorsAsExceptions = false -const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) - export const AppScreen = () => { useEffect(() => { launchScenario() @@ -22,58 +19,12 @@ export const AppScreen = () => { ) } -const HomeScreen = (props) => { - useEffect(() => { - (async () => { - await delay(1000) - Bugsnag.notify(new Error('HomeNavigationError')) - await delay(250) - Navigation.push(props.componentId, { - component: { - name: 'Details' - } - }) - })() - }, []) - - return ( - - Home Screen - - ) -} - -const DetailsScreen = (props) => { - useEffect(() => { - (async () => { - await delay(1000) - Bugsnag.notify(new Error('DetailsNavigationError')) - await delay(250) - throw new Error('DetailsNavigationUnhandledError') - })() - }, []) - - return ( - - Details Screen - - ) -} - Navigation.registerComponent('App', () => AppScreen) -Navigation.registerComponent('Home', () => HomeScreen) -Navigation.registerComponent('Details', () => DetailsScreen) Navigation.events().registerAppLaunchedListener(async () => { Navigation.setRoot({ root: { - stack: { - children: [ - { - component: { - name: 'App' - } - } - ] + component: { + name: 'App' } } }) diff --git a/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js b/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js index 338825b3d..964815d42 100644 --- a/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js +++ b/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsDisabledScenario.js @@ -1,6 +1,49 @@ import Scenario from './Scenario' -import { Navigation } from 'react-native-navigation' +import Bugsnag from '@bugsnag/react-native' import BugsnagReactNativeNavigation from '@bugsnag/plugin-react-native-navigation' +import React, { useEffect } from 'react' +import { Text, View } from 'react-native' +import { Navigation } from 'react-native-navigation' + +const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) + +const HomeScreen = (props) => { + useEffect(() => { + (async () => { + await delay(1000) + Bugsnag.notify(new Error('HomeNavigationError')) + await delay(250) + Navigation.push(props.componentId, { + component: { + name: 'Details' + } + }) + })() + }, []) + + return ( + + Home Screen + + ) +} + +const DetailsScreen = (props) => { + useEffect(() => { + (async () => { + await delay(1000) + Bugsnag.notify(new Error('DetailsNavigationError')) + await delay(250) + throw new Error('DetailsNavigationUnhandledError') + })() + }, []) + + return ( + + Details Screen + + ) +} export class ReactNativeNavigationBreadcrumbsDisabledScenario extends Scenario { constructor (configuration, jsConfig) { @@ -10,6 +53,9 @@ export class ReactNativeNavigationBreadcrumbsDisabledScenario extends Scenario { } run () { + Navigation.registerComponent('Home', () => HomeScreen) + Navigation.registerComponent('Details', () => DetailsScreen) + Navigation.setRoot({ root: { stack: { diff --git a/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js b/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js index bec24454d..249f84c3a 100644 --- a/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js +++ b/test/react-native/features/fixtures/scenario-launcher/src/scenarios/ReactNativeNavigationBreadcrumbsEnabledScenario.js @@ -1,7 +1,50 @@ import Scenario from './Scenario' +import Bugsnag from '@bugsnag/react-native' import BugsnagReactNativeNavigation from '@bugsnag/plugin-react-native-navigation' +import React, { useEffect } from 'react' +import { Text, View } from 'react-native' import { Navigation } from 'react-native-navigation' +const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) + +const HomeScreen = (props) => { + useEffect(() => { + (async () => { + await delay(1000) + Bugsnag.notify(new Error('HomeNavigationError')) + await delay(250) + Navigation.push(props.componentId, { + component: { + name: 'Details' + } + }) + })() + }, []) + + return ( + + Home Screen + + ) +} + +const DetailsScreen = (props) => { + useEffect(() => { + (async () => { + await delay(1000) + Bugsnag.notify(new Error('DetailsNavigationError')) + await delay(250) + throw new Error('DetailsNavigationUnhandledError') + })() + }, []) + + return ( + + Details Screen + + ) +} + export class ReactNativeNavigationBreadcrumbsEnabledScenario extends Scenario { constructor (configuration, jsConfig) { super() @@ -9,6 +52,9 @@ export class ReactNativeNavigationBreadcrumbsEnabledScenario extends Scenario { } run () { + Navigation.registerComponent('Home', () => HomeScreen) + Navigation.registerComponent('Details', () => DetailsScreen) + Navigation.setRoot({ root: { stack: {