Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA cannot resolve React Native import

enter image description here

The React import is ok, but other import can not used in autocompletion.

If I import as import Text from 'react-native', this can be resolve correctly, but this is incorrect import.So I assume IDE will resolve symbol by lookup import Class name only, The question is how can I work around this ?

like image 973
wener Avatar asked May 07 '16 03:05

wener


People also ask

Does IntelliJ IDEA support React Native?

The plugins are available only in IntelliJ IDEA Ultimate, where they are enabled by default. With React Native you can develop native mobile applications for iOS and Android using JavaScript and React.

Which IDE is best for React JS?

We consider WebStorm to be the best-paid IDE on the market for React development, thanks to its many features, plugins, and good documentation.


1 Answers

The problem occurs because of a tricky way react-native modules are defined. I'd suggest using typescript community stubs to solve the issue: Preferences | Languages & Frameworks | JavaScript | Libraries, press Download, then choose 'react-native' from the stubs list

like image 112
lena Avatar answered Oct 11 '22 16:10

lena