'How to prevent VS Code auto importing from 'react-native-web'?
When I type View
, I expect VS Code to automatically import { View } from 'react-native';
but what is does is import { View } from 'react-native-web';
. The problem is that anything imported from 'react-native-web' creates errors and never seems to work.
What are the procedures to prevent this from happening? I am tired of manually importing every elements from 'react-native'.
PS. I am using Auto Import VS Code extension.
Solution 1:[1]
I am actually facing a similar 'bug'. However, what you can do is you can install @types/react-native
package.
For npm: npm install --save @types/react-native
For yarn: yarn add @types/react-native
This is just a workaround, because it used to work without that Typescript package before. Alas, this will at least save you from manually importing the elements.
Also, I'm assuming that you already have react-native-tools
extension installed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |