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

Use Cordova plugins #7

Open
Andgrin opened this issue Jan 31, 2019 · 1 comment
Open

Use Cordova plugins #7

Andgrin opened this issue Jan 31, 2019 · 1 comment

Comments

@Andgrin
Copy link

Andgrin commented Jan 31, 2019

Hi!
Have any ideas how to use cordova plugins inside react?
For example simplest cordova-plugin-device

Trying call like:

  • console.log(device.cordova);
  • --/-- window.cordova.plugins.device.cordova
  • --/-- window.plugins.device.cordova

But nothing works.

@aicos
Copy link

aicos commented Feb 6, 2019

This is not really possible if you want to use the development server from your desktop. If the plugins have been made to support the web browser, you can launch the cordova emulator in web mode. Otherwise you will have to deploy your code to the final platform you are developing for to get access to those plugins.

The way I've been developing is to create a working gui in react and just provide mocking functions so that the gui can be tested. When my code is running on the real device, I have some if-logic to detect this, which then makes use of the actual plugins.

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

No branches or pull requests

2 participants