Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeBase components cannot be resolved in IDE (PhpStorm/WebStorm) #1075

Closed
lashae opened this issue Jul 19, 2017 · 13 comments
Closed

NativeBase components cannot be resolved in IDE (PhpStorm/WebStorm) #1075

lashae opened this issue Jul 19, 2017 · 13 comments

Comments

@lashae
Copy link

lashae commented Jul 19, 2017

react-native, react and native-base version

RN: 0.45.1 React: 16.0.0-alpha.12 NativeBase: 2.2.0

Expected behaviour

Since NativeBase has its type definitions file within it (node_modules/native-base/index.d.ts) my IDE should be able to resolve imported components. All of my other dependencies can be resolved by PhpStorm without any problem, like: React, React-Native, Redux, propTypes etc.

Actual behaviour

When I use following statement in my IDE (phpStorm)

import { connectStyle, Button, Text } from 'native-base';

I get: Cannot resolve symbol error for all the components imported.

Steps to reproduce (code snippet or screenshot)

Create a new project on PhpStorm with React, ReactNative and NativeBase. Then add the following import statement to any JS file.

import { connectStyle, Button, Text } from 'native-base';

Screenshot of emulator/device

N/A

Is the bug present in both ios and android or in any one of them?

N/A

Any other additional info which would help us debug the issue quicker.

N/A

@VahidBo
Copy link
Contributor

VahidBo commented Jul 30, 2017

+1

2 similar comments
@stone1549
Copy link

+1

@ratelgogo
Copy link

+1

@darkopetrovic
Copy link

For a temporary fix.

In \node_modules\native-base\index.d.ts: comment the imports:

//import * as React from "react";
//import * as ReactNative from "react-native";

declare module "native-base" {

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000489950-JavaScript-Modules-with-Namespaces-Cannot-resolve-symbol

@haciSeydaoglu
Copy link

@darkopetrovic Thank you so much. This worked.

@acilgit
Copy link

acilgit commented Sep 18, 2017

It works, thx

@narek11
Copy link

narek11 commented Sep 29, 2017

thanks, works

@Swahjak
Copy link

Swahjak commented Nov 2, 2017

Any updates? The solution, as is says, is "temporary". Every time yarn / npm runs the fix is removed from the file.

Edit; or is this an Intellij / Webstorm / Phpstorm /... issue?

@Manugal
Copy link

Manugal commented Dec 4, 2017

@darkopetrovic It works!

This temporary fix might be a PR ;)

@kk412027247
Copy link

@darkopetrovic thanks a lot. I fix it finally, that confuced me a lot before.

@IlyaGulya
Copy link

#1075 (comment)

Actually, this fix does not fix the problem fully. Imports begin working, but instead it breaks ability of IDE to suggest properties that inherited from base ReactNative components

@IlyaGulya
Copy link

Guys, any progress here?
This is really annoying bug.

hexelon added a commit to hexelon/NativeBase that referenced this issue Feb 17, 2018
SupriyaKalghatgi added a commit that referenced this issue Mar 6, 2018
Fixes the confusion in webstorm/phpstorm #1075
@SupriyaKalghatgi
Copy link
Contributor

Fixed with NB 2.3.10

IlyaGulya pushed a commit to IlyaGulya/NativeBase that referenced this issue Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests