Clipboard seems to be a pretty standard part of react-native's API. All of the tutorials on react-native's Clipboard tell me the same thing, just do this:
import { Clipboard } from 'react-native';
and I'm golden. Problem is, I'm getting complaints from my IDE that I:
Cannot import Clipboard because there is no Clipboard export in react-native
I'm very confused at this point and it doesn't seem that anyone else through a quick google search of my error msesage has ever had this problem before. I don't even know how to even begin debugging this. Or if even needs debugging as the code seems to work perfectly fine despite the complaints.
The Clipboard module was moved to react-native-community/react-native-clipboard.
You can install it with:
npm install --save #react-native-community/react-native-clipboard
and import it with:
import Clipboard from "#react-native-community/react-native-clipboard";
You can read more about it here
Related
I am trying to import tensorflow.keras.applications in Google Colab. The imported module works fine. There is no compilation error. But, I am being shown a yellow curved underline, kind of a warning.
Error:
What is the problem that leads to such a warning?
Thank you.
You are not the only one experiencing this, and it does not happen only in Google Colab. It is a bug in Tensorflow.
Since it is just a warning you could ignore it. However if you like having code completion like I do you can substitute your imports from this:
import tensorflow.keras.x
To this:
import keras.api._v2.keras.x
Where x is the import you want to get.
I am relatively new to programming and I have some trouble with importing SwitchSelector, which I am going to use to switch language manually in my React Native app, I tried to follow this video: https://www.youtube.com/watch?v=kq9LqHKgNOA&t=47s.
I have installed it with this command: npm i react-native-switch-selector --save
And imported with this line: import SwitchSelector from "react-native-switch-selector";
But under the import line there is dotted line and when I hover over it I get this message: Could not find a declaration file for module 'react-native-switch-selector'. 'C:/Users/carol/Documents/kand_arbete/Sporta/node_modules/react-native-switch-selector/index.js' implicitly has an 'any' type.
Do anyone know how I can fix it? If not, how can I solve this with buttons instead?
I would be really grateful if someone could help me!
I want to open Camer by using the below npm package, but it is producing this error.
https://www.npmjs.com/package/react-native-camera-kit
import {CameraScreen} from 'react-native-camera-kit';
<CameraScreen
// Barcode props
scanBarcode={true}
onReadCode={(event) => Alert.alert('QR code found')} // optional
showFrame={true}
laserColor="red"
frameColor="white"
/>
I had the same issue. It's an issue with the import in the package itself. Go to CameraScreen.tsx file either by exploring the node modules folder manually or just Ctrl + Left Click on the class CameraScreen in your code. In there, scroll to top and look at the imports. There will be a red line (depends on your code editor) under the Camera import (as shown in the attached image). Just change it to ./Camera.android or ./Camera.ios depending on the platform you're developing for. Solved my issue.
Image or problematic code
I need to make a Vue.js site with a JavaScript Ink interpreter. The only one that seems to be production-ready is Ink.js. There are two ways to import it. One is in its TypeScript format, but my Vue setup does not use TypeScript. I could add it, maybe, although I'm not sure I want to. If I import the TypeScript libraries from Yarn, no matter which object I import, it shows up with a value of undefined in my code.
Then there is a pure es5 script available, that seems to be a transpiled version of the first one, but when I try to import that one, I get this error, I think from Babel:
Uncaught SyntaxError: Unexpected token '!'
cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/Ink.vue?vue&type=script&lang=js&:39 Uncaught SyntaxError: Unexpected token '!'
at Object../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/Ink.vue?vue&type=script&lang=js& (app.js:962)
My guess is that Babel is set up for es6 or es7 and the pure is5 file brings up some unexpected syntax. I tried to change babel.config.js, but I've found no option that's kept Vue.js from complaining. What am I doing wrong?
After many failed attempts, I went around the problem in the following way: I imported the Story object directly from the library:
import { Story } from '../../node_modules/inkjs/engine/Story';
// ...
let story = new Story(storyText);
I know it's not what the documentation recommends, but it works. And it seems everything else that needs to be imported is, because when I try to read story.currentChoices I get an array of Choice objects that are in turn perfectly readable.
So this works for me. If anyone else runs into this problem, I'm not saying it's the right solution, I'm just saying that's what I finally ended up doing.
I just installed rxjs 5 beta 3 via npm i rxjs#5.0.0-beta.3.
I have the following example code:
import {Observable} from "rxjs"
new Observable(o => o.next(42)).filter(() => true);
This code compiles perfectly well when using ts-node for example.
But when looking at this code inside IntelliJ IDEA, the filter() operator is not found.
When using operators on an Observable instance, they are not found either.
The suggested static members of Observable are:
create()
if()
throw()
The suggested members of an instance of Observable are:
_isScalar()
forEach()
lift()
subscribe()
I also tried to import only what I need, but still my IDE tells me that filter() does not exist on the Observable instance:
import {Observable} from "rxjs/Observable"
import "rxjs/add/operator/filter"
new Observable(o => o.next(42)).filter(() => true);
Any suggestions how to make IntelliJ IDEA know about the operators?
To fix this issue you need to add RxJS as a javascript library in IntelliJ:
Go to Settings -> Languages and frameworks -> JavaScript -> Libraries
Click Add...
Add node_modules/rxjs by clicking the + button
Click all the OK buttons until you are back in your editor.
This solution is tested to work on IDEA 2016.1.3
Please, check IDEA 2016.1.2 or higher
Note: Directory node_modules must be not excluded from the project.
Otherwise, see answer https://stackoverflow.com/a/38499577/1057218
Note 2: File package.json must contain the direct dependency (or devdependency) 'rxjs'
Accepted answer doesn't work. I have tested IntelliJ IDEA 2016.2.1 EAP (ideaIU-162.1447.7) and the problem still persist.
The rabbit hole goes as follows:
In the accepted answer you find a link to version 2016.1, but that doesn't fix the problem.
Then you see a comment with a link to the IntelliJ bugtracker, where OP has the first/top comment.
At the bottom of that issue/bug thread you find a comment saying IDEA 2016.2 162.426.1 EAP will definitely fix the problem, it doesn't.
Bottom line, if you import all of what RxJS has to offer with import {Observable} from 'rxjs/Rx'; IntelliJ will still complain that it can't find methods like .map and .filter