akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.3k stars 952 forks source link

Can't find variable: React #1760

Closed gghangura closed 11 months ago

gghangura commented 1 year ago

🐛 Bug Report

I updated ui-kitten/components and ui-kitten/eva-icons from 5.1.2 to 5.3.0 and I am getting the following error.

ERROR ReferenceError: Can't find variable: React

This error is located at: in ApplicationProvider (at native/index.js:54) in ThemeWrapper (at native/index.js:36) in Provider (at native/index.js:35) in App (at App.js:16) in App (at gestureHandlerRootHOC.tsx:13) in GestureHandlerRootView (at GestureHandlerRootView.android.tsx:14) in GestureHandlerRootView (at gestureHandlerRootHOC.tsx:12) in gestureHandlerRootHOC(App) (at renderApplication.js:50) in RCTView (at View.js:32) in View (at AppContainer.js:92) in RCTView (at View.js:32) in View (at AppContainer.js:119) in AppContainer (at renderApplication.js:43) in ShadowHQ(RootComponent) (at renderApplication.js:60)

The error looks to be on line 93 in applicationProvider.component.js.

Here is my code


  return (
    <React.Fragment>
      <IconRegistry icons={EvaIconsPack} />
      <ApplicationProvider
        {...eva}
        theme={appThemes[mapping][theme]}
        customMapping={appMappings[mapping].customMapping}>
        <StyledStatusBar />
        <SafeAreaProvider>
          <NavigationContainer
            ref={navigationRef}
            onReady={() => {
              isReadyRef.current = true;
            }}>
            {Routes()}
          </NavigationContainer>
        </SafeAreaProvider>
      </ApplicationProvider>
    </React.Fragment>
  );

To Reproduce

Just updated the project that worked with 5.1.2.

Expected behavior

the application to run without errors.

Link to runnable example or repository (highly encouraged)

UI Kitten and Eva version

Package Version
@eva-design/eva 5.3.0
@ui-kitten/components 5.3.0

Environment information

System: OS: macOS 13.4 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.3/14E222b - /usr/bin/xcodebuild npmPackages: react: 17.0.2 => 17.0.2 react-native: 0.68.3 => 0.68.3

R3DST0RM commented 1 year ago

Given the package.json of UI-Kitten, it seems to require React 18. Try to upgrade your project to use React 18, let me know if that works for you.

gghangura commented 1 year ago

I will give it a try.

tuantu196 commented 11 months ago

I will give it a try.

Have you resolved it?

Bill-Niz commented 11 months ago

this didn’t solve the issue for me

robertoconceicao commented 10 months ago

I have the same issue

VladSt90 commented 10 months ago

The same issue

vcankur commented 10 months ago

same issue

Th0mYT commented 8 months ago

For me was enough remove the ^ char from the ui-kitten deps in the package.json

mar-ale-fer commented 8 months ago

Because of restrictions on my environment (can't change package versions) , and because I only need to test something, I manually fixed this problem inside the node_modules/@ui-kitten. Resolving a problem at a time I have the application running on android.

Then the process is: 1- take note of the file that is with errors. 2- add import React from 'react'; at the top of that file.

for instance those files: node_modules/@ui-kitten/components/theme/application/applicationProvider.component.js

"use strict";
/**
  * @license
  * Copyright Akveo. All Rights Reserved.
  * Licensed under the MIT License. See License.txt in the project root for license information.
  */
import React from 'react'; //<--- I added this. ------

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};

when resolved, another file with errors is reported, next file:

other files:

I think react / react-native recent versions implicitly include this import.

ghousesaqlain commented 6 months ago

Still facing the issue with "react": "^18.2.0", "react-native": "^0.72.4", "@eva-design/eva": "2.2.0", "@ui-kitten/components": "5.3.1", "@ui-kitten/eva-icons": "5.3.2",

Anyone have fix for this error?