mohebifar/react-native-copilot

ReferenceError: Can't find variable: React

guilhermefparra opened this issue · 13 comments

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

same here

same here

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

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

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

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

@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.

@Nawaf007 Can we connect for this??

cnhuz commented

same here

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

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.

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

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?