Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create-react-app/react-native-elements error

Started a project with create-react-app. Installed react-native: "^0.57.8",react-native-elements: "^0.19.1" and react-native-vector-icons: "^6.1.0". To be able to use components within react-native-elements within a project.

When I run npm start I get the error code pasted below. I've read through the the react-native-elements documentation but can't seem to find anything to help me

./node_modules/react-native-elements/src/avatar/Avatar.js
 SyntaxError: D:\Location-Map\Neighborhood-Map-2-\location- 
 app\node_modules\react-native-elements\src\avatar\Avatar.js: Unexpected 
 token (92:8)

  90 | 
  91 |       return (
> 92 |         <TouchableHighlight
     |         ^
  93 |           style={[
  94 |             styles.editButton,
  95 |             editButtonSizeStyle,
like image 752
Afeez Jimoh Avatar asked Jan 14 '19 23:01

Afeez Jimoh


People also ask

What is an invariant violation?

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

How do I check my error code in react native?

First open Developer Tools in Simulator. Then press Command+D keyboard shortcut. It will open the developer tools. To debug the JavaScript code in Chrome, select "Debug JS Remotely" from the Developer Menu.


1 Answers

You can't do that (read here if you want to know why). Do you want to build a web app? Use React with create-react-app. Do you want to build a mobile app? Use React Native with Expo or react-native init.

I suggest you look into material-ui as a component library for React.

like image 83
J. Hesters Avatar answered Oct 13 '22 19:10

J. Hesters