Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plugin for React Native Navigation #1065

Merged
merged 7 commits into from
Oct 2, 2020

Conversation

imjoehaines
Copy link
Contributor

@imjoehaines imjoehaines commented Sep 22, 2020

Goal

This PR adds a plugin for React Native Navigation. This plugin sets the context to the name of the currently rendered component and leaves a breadcrumb on each navigation change

Usage:

import { Navigation } from 'react-native-navigation'
import Bugsnag from '@bugsnag/react-native'
import BugsnagPluginReactNativeNavigation from '@bugsnag/plugin-react-native-navigation'

Bugsnag.start({
  plugins: [new BugsnagPluginReactNativeNavigation(Navigation)]
})

@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Sep 22, 2020

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 40.57 kB 12.52 kB
After 40.57 kB 12.52 kB
± No change No change

Generated by 🚫 dangerJS against 1a885ba

@imjoehaines imjoehaines marked this pull request as ready for review September 22, 2020 16:47
@imjoehaines imjoehaines requested a review from a team as a code owner September 22, 2020 16:47
Copy link
Contributor

@bengourley bengourley left a comment

Choose a reason for hiding this comment

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

Looks good. Nice and simple.

  • Have you tested it manually on an example app?
  • As a top-level plugin it will need types (there will be a similar example when I push my branch in a bit)
  • A docs PR is needed

@imjoehaines imjoehaines force-pushed the react-native-navigation-plugin branch 3 times, most recently from 0778412 to 5d64d90 Compare September 24, 2020 08:22
@imjoehaines
Copy link
Contributor Author

Have you tested it manually on an example app?

Yeah, I've tested v2, v3, v4, v5, v6 & v7

As a top-level plugin it will need types (there will be a similar example when I push my branch in a bit)

Added in 5d64d90

A docs PR is needed

👍

Copy link
Contributor

@bengourley bengourley left a comment

Choose a reason for hiding this comment

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

Looks good, manually verified working as expected on an example project.

Copy link
Contributor

@twometresteve twometresteve left a comment

Choose a reason for hiding this comment

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

No comments from a test perspective.

@Cawllec
Copy link
Contributor

Cawllec commented Sep 30, 2020

I tripped up creating the test fixtures because I'd not passed Navigation into the new BugsnagReactNativeNavigation() call.

It took a while to debug due to not having an error message, just a silent failure. Can we add some sort of message to that?

@imjoehaines
Copy link
Contributor Author

I tripped up creating the test fixtures because I'd not passed Navigation into the new BugsnagReactNativeNavigation() call.

It took a while to debug due to not having an error message, just a silent failure. Can we add some sort of message to that?

We could but it definitely shouldn't be a silent failure; as soon as load is called it will try to call a method on Navigation. If it's not passed in that will throw, with a stacktrace pointing to the plugin. Were javascript errors being suppressed somehow in the way the tests are setup?

I think it's fine to add an error anyway though — what do you think @bengourley?

@bengourley
Copy link
Contributor

It's not silent, but I guess crucially the error happens after the mistake was made. I think it would be a reasonable improvement to add a more friendly error in the constructor.

Though this got me thinking, is there a use case for passing in Navigation later, in the way that we do with the React and Vue plugins?

@imjoehaines imjoehaines force-pushed the react-native-navigation-plugin branch from 3c2f314 to 1a885ba Compare October 1, 2020 15:26
@imjoehaines imjoehaines merged commit f980280 into next Oct 2, 2020
@imjoehaines imjoehaines deleted the react-native-navigation-plugin branch October 2, 2020 14:16
@djskinner djskinner mentioned this pull request Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants