orYoffe/create-react-native-web-app

Error when adding react native elements

Hamidrezana opened this issue · 1 comments

I got error when adding react native elements to project.

./node_modules/react-native-elements/src/avatar/Avatar.js
SyntaxError: /home/hamidreza/Desktop/reactElement/node_modules/react-native-elements/src/avatar/Avatar.js: Unexpected token (72:4)

  70 | 
  71 |   const Utils = showAccessory && (
> 72 |     <TouchableHighlight
     |     ^
  73 |       style={StyleSheet.flatten([
  74 |         styles.accessory,
  75 |         {

How can I solve this problem?

Since "native" packages don't include compiled code (es5 after babel and jsx transformation), to use them in web you must add the libraries to the webpack config.
See example here:
#79 (comment)