react-native-progress-webview Unable to resolve module - react-native

I found this project interesting at the NPM,
https://www.npmjs.com/package/react-native-progress-webview
however I followed the instruction, it shows the following error:
error: bundling failed: Error: Unable to resolve module `react-native-progess-webview` from `mycomponent.js`: Module `react-native-progess-webview` does not exist in the Haste module map
I already installed 'react-native-webview' and it works fine, however react-native-progess-webview seems not able to be imported.
I am just simply importing the library like this:
import ProgressWebView from "react-native-progess-webview";
How to solve?

I found that it is a typo in the tutorial, in the tutorial it is:
import ProgressWebView from "react-native-progess-webview";
but the correct one is:
import ProgressWebView from "react-native-progress-webview";
There is an "r" in the "progress".

Related

Cannot use import statement outside a module when using wrangler v2

I'm new to using cloudflare and wrangler. I've a project that I've been working on, and I'm now trying to deploy it using wrangler publish, but I keep running into issues. My product is coded in node.js, and I'm using version 2 of wrangler. When I execute wrangler publish I get:
Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
at worker.js:2Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
at worker.js:2
I've searched for a solution, and one of them that I found said to change module in wrangler.toml from type="javascript"to type="webpack" however that gives me a bunch of errors:
./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' ... Parsed request is a module...resolve as module
/Users/Desktop/APIs/cpiCalculator2/node_modules/destroy/node_modules doesn't exist or is not a directory
...
Error: webpack returned an error. You may be able to resolve this issue by running npm install.
I've tried reinstalling npm as it suggests and then wrangler publish again, but that just gives me the same error message.
I'm really not sure what the issue is, and I would really appreciate any help or advice on how to resolve this issue. Thank you!
Also, just a note, I'm not sure if this is affecting it, but I do have two other js documents in the main area of my project (where my index.js file is).

Mypy typing errors when upgrading to Twisted 21.2.0

In trying to upgrade the Twisted package from 20.3.0 to 21.2.0.
After the upgrade, when running Mypy I'm getting the following errors when accessing the reactor (from twisted.internet import reactor):
error: Module has no attribute "run" [attr-defined]
error: Module has no attribute "running" [attr-defined]
error: Module has no attribute "running" [attr-defined]
error: Module has no attribute "callLater" [attr-defined]
error: Module has no attribute "callInThread" [attr-defined]
error: Module has no attribute "callFromThread" [attr-defined]
error: Module has no attribute "spawnProcess" [attr-defined]
error: Module has no attribute "spawnProcess" [attr-defined]
When running Mypy with reveal_type(reactor):
Revealed type is '_importlib_modulespec.ModuleType'
I'm trying to understand what is the best way to handle this situation without just ignoring the errors so I can have the type checking when using the reactor.
Is there a better way to import the reactor? Is there a way to mark the type of the reactor for Mypy? should I cast it to a type every time before using it?
This seems to be an assigned bug in Twisted (https://twistedmatrix.com/trac/ticket/9909) and the proposed fix sounds like a breaking change.
One of the comments on their Trac describes casting it, as you suggest, as a workaround:
from typing import cast
import twisted.internet.reactor
from twisted.internet.interfaces import IReactorCore
reactor = cast(IReactorCore, twisted.internet.reactor)
reactor.run()
It took a ridiculous amount of searching but I finally found the solution in the Twisted source code itself. Add the following comment to the end of your line:
# type: ignore[attr-defined]
for example:
reactor.callFromThread(reactor.stop) # type: ignore[attr-defined]
That will "fix" it.

trying to use tipsi-twitter in snack.expo.io?

I'm trying to use tipsi-twitter in snack.expo.io but I'm running into issues. I added the following item into package.json dependencies:
"tipsi-twitter": "*"
Expo then appeared to successfully install this package. In my App.js I included the following import:
import TwitterAuth from 'tipsi-twitter';
The import compiles successfully but when I put the following code after the imports:
TwitterAuth.init({
twitter_key: '<TWITTER_KEY>',
twitter_secret: '<TWITTER_SECRET>',
})
This returns an error of:
"Cannot read property 'init' of undefined"
But this appears to be the exact implementation in the Usage section of the tipsi-twitter github page:
https://github.com/tipsi/tipsi-twitter#usage
Any idea what the issue might be or how to debug? Am I possibly missing some type of configuration step or is it possible that expo.io doesn't support this package/scenario?

Libraries installed but didn't work in react-native environment

Anytime I install Library, whether it is, native base or react-native text-input effects.it gives the same error every time..
I don't know what's causing an issue here.
error: bundling failed: Error: While trying to resolve module
native-base` from file `/home/jas/Hopper/screen/Home.js`, the package `
/home/jas/Hopper /node_modules/native-base/package.json` was successfully
found. However, this package itself specifies a `main` module field that
could not be resolved (`/home/jas/Hopper/node_modules/native-base/dist
/src/index.js`. Indeed, none of these files exist:
Delete the build folder in /node_modules/native-base/android/app

Angular flex-layout in Ionic3... rxjs/operator not found?

Trying to use #angular/flex-layout in an existing npm-enabled Ionic 3 project.
Adding "FlexLayoutModule" to my main module's imports won't allow the app to start, saying that: cannot find module "rxjs/operators" is the cause.
Already cleared node_module, npm install, reinstalled Ionic CLI. Nothing helps. Could it be a version conflict? Moreover, I'm already using Observables in this project. I don't get it. And the import of "FlexLayoutModule" is in cause of this issue (disabling the import removes the issue).
Anyone could be successful at using flex-layout with ionic? I've seen this plunk, but it uses system.js, so not 100% reproducing my goal.
http://plnkr.co/edit/y8R0MF?p=info
Edit: a more verbose issue:
Uncaught (in promise): Error: Cannot find module "rxjs/operators"
Error: Cannot find module "rxjs/operators" at Object.580
(http://localhost:8100/build/22.main.js:319:7) at webpack_require
(http://localhost:8100/build/main.js:48:30) at Object.1021
(http://localhost:8100/build/22.main.js:11:79) at webpack_require
(http://localhost:8100/build/main.js:48:30) at
http://localhost:8100/build/main.js:122015:10 at t.invoke
(http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke
(http://localhost:8100/build/main.js:4650:37) at t.invoke
(http://localhost:8100/build/polyfills.js:3:9223) at r.run
(http://localhost:8100/build/polyfills.js:3:4452) at
http://localhost:8100/build/polyfills.js:3:14076
I'm getting a similar error with Angular CLI. Everything is OK until I include FlexLayoutModule in the app's NgModule imports. Then I get the error:
Module not found: Error: Can't resolve 'rxjs/operators' in 'D:\dev\Vms.Signup.Client\node_modules\#angular\flex-layout\esm5'
I updated to the latest rxjs and that seems to have fixed it.