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

ReferenceError: Can't find variable: React #282

Open
guilhermefparra opened this issue Apr 13, 2023 · 13 comments
Open

ReferenceError: Can't find variable: React #282

guilhermefparra opened this issue Apr 13, 2023 · 13 comments

Comments

@guilhermefparra
Copy link

Current Behavior
I just installed the lib and was following the Usage guide, and this error occurred: "ReferenceError: Can't find variable: React".

Input Code

image

Expected behavior/code
A clear and concise description of what you expected to happen (or code).

Environment

  • react-native-copilot: v3.2.1
  • react-native: v0.68.5
  • react-native-svg: v12.3.0

Additional context/Screenshots
image

@SwikarBhattarai
Copy link

same here

1 similar comment
@Nawaf007
Copy link

same here

@dima-devs
Copy link

Same here. Hi @guilhermefparra Have you got the solution?

@Nilesh8451
Copy link

@dima-devs @SwikarBhattarai @guilhermefparra Any update on the issue how we can resolve this??? Please it's urgent

@Nawaf007
Copy link

I did have one solution i.e. to copy the library into your project and use it from there for now.

@Nilesh8451
Copy link

@Nawaf007 But how to get rid of that error. Where you have added import React line ??

@Nawaf007
Copy link

Nawaf007 commented Apr 28, 2023

@Nilesh8451 I haven't, since base project has no issues with the imports, it simply loads it. Just place the src folder at a specific directory within your project, and access it. Things might work for you too.

@Nilesh8451
Copy link

@Nawaf007 Can we connect for this??

@cnhuz
Copy link

cnhuz commented May 9, 2023

same here

@SyntaxError403
Copy link

Facing the same issue and even tried the suggested method of moving the library outside the default location and importing it manually.

@Nawaf007
Copy link

Nawaf007 commented May 19, 2023

Facing the same issue and even tried the suggested method of moving the library outside the default location and importing it manually.

Don't move the complete library. Just the code of the library, and install it's dependencies manually, as if it's your own custom code.

@Salmankhan033
Copy link

Salmankhan033 commented Jun 5, 2023

I import react then it starts working fine.
see the below answer
https://stackoverflow.com/a/76406743/14266627

@Saigronas
Copy link

Saigronas commented Jun 13, 2023

Got the same problem when trying to implement this library today.

I import react then it starts working fine. see the below answer https://stackoverflow.com/a/76406743/14266627

This fix resolved the error here, by adding "import * as React from 'react';" to the top of index.js at
\node_modules\react-native-copilot\dist\index.js

But shouldn't this be unnecessary? And if it does need to import react, should it perhaps be done in the package by default?

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

9 participants