wener wener - 3 years ago 376
React JSX Question

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 ?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download