Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: Can't find variable: Text (i am using expo application for react native)

this error is showing in my ios screen after downloading java script in my device.

ReferenceError: Can't find variable: Text

This error is located at:
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
like image 781
mona alshehri Avatar asked Jun 24 '18 08:06

mona alshehri


2 Answers

Import Text from react native.

 import {
      View,
      Text,
 } from 'react-native';
like image 58
Pravin Avatar answered Nov 05 '22 08:11

Pravin


Importing react-native is not enough here.

Module not found: Can't resolve 'react-native'

Instead, you need an additional package:

yarn add react-native-web

Now you are able to use

import {Text} from 'react-native'
like image 45
kwoxer Avatar answered Nov 05 '22 08:11

kwoxer