question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Methods only accessible from Communications.default, not Communications when using old styled import

See original GitHub issue

Edit: Quick answer -> using an old styled import require('...') can cause this behavior.

I just installed this plugin, I am using version 2.1.0

I am running this on the IOS simulator with React Native 0.28.0, the docs say to just call: Communications.web(...

but in order for it to work, I need to call it this way (discovered this through debugging): Communications.default.web(...

I believe this was introduced in this commit https://github.com/anarchicknight/react-native-communications/commit/460c7d8dc2123d0efaedd90a58ced0e6f705cff9 when the last line of AKCommunications.js was changed from module.exports = communication; to export default communication;

I’m not great with es6 yet, so the above is an educated guess. This isn’t a big issue, but I think it should either be changed back to match the documentation, or update the documentation.

Hopefully this helps, I’ll try to respond as promptly as possible but I am a very busy person (aren’t we all?) p.s. If I end up being right that that’s the issue, I can make a PR to get my hands in this repo. Thanks for open sourcing it!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
anarchicknightcommented, Sep 12, 2016

cheers.

I definitely want to read up on the mixing of the old and new style though and find out if there are ways around it etc, and if not will update the docs to emphasise using the new style import

0reactions
anarchicknightcommented, Sep 27, 2016

I have made some changes to how the Communications object and individual methods are exported.

It seems to work for me now when using old & new styles

e.g. var Communications = require(‘react-native-communications’) or import Communications from ‘react-native-communications’

will now both work when calling Communications.web(‘http://www.github.com’) etc

The ability to import single methods will also be available

e.g. import { web } from ‘react-native-communications’ which can be called just as web(‘http://www.github.com’)

The updated version should be committed in the next couple of days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Python Style Guide
Style guides for Google-originated open-source projects. ... Use import statements for packages and modules only, not for individual classes or functions.
Read more >
Context | Android Developers
AccessibilityService, Accessibility services should only be used to assist ... styled CharSequence from the application's package's default string table.
Read more >
Effective Go - The Go Programming Language
The package name is only the default name for imports; it need not be unique across all source code, and in the rare...
Read more >
Using Web Workers - Web APIs - MDN Web Docs
A dedicated worker is only accessible from the script that first ... or use some default methods and properties of the window object....
Read more >
tkinter.ttk — Tk themed widgets — Python 3.11.1 documentation
The tkinter.ttk module provides access to the Tk themed widget set, ... from tkinter import ttk ... Used to communicate with horizontal scrollbars....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found