react-native-copilot icon indicating copy to clipboard operation
react-native-copilot copied to clipboard

ReferenceError: Can't find variable: React

Open guilhermefparra opened this issue 2 years ago • 13 comments
trafficstars

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

guilhermefparra avatar Apr 13 '23 15:04 guilhermefparra

same here

SwikarBhattarai avatar Apr 17 '23 07:04 SwikarBhattarai

same here

Nawaf007 avatar Apr 20 '23 20:04 Nawaf007

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

dima-devs avatar Apr 26 '23 12:04 dima-devs

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

Nilesh8451 avatar Apr 28 '23 15:04 Nilesh8451

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

Nawaf007 avatar Apr 28 '23 15:04 Nawaf007

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

Nilesh8451 avatar Apr 28 '23 17:04 Nilesh8451

@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 avatar Apr 28 '23 17:04 Nawaf007

@Nawaf007 Can we connect for this??

Nilesh8451 avatar May 02 '23 07:05 Nilesh8451

same here

cnhuz avatar May 09 '23 10:05 cnhuz

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

SyntaxError403 avatar May 19 '23 04:05 SyntaxError403

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.

Nawaf007 avatar May 19 '23 04:05 Nawaf007

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

Salmankhan033 avatar Jun 05 '23 13:06 Salmankhan033

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?

Saigronas avatar Jun 13 '23 08:06 Saigronas