簡體   English   中英

create-react-app/react-native-elements 錯誤

[英]create-react-app/react-native-elements error

使用 create-react-app 啟動了一個項目。 安裝 react-native: "^0.57.8", react-native-elements: "^0.19.1" 和 react-native-vector-icons: "^6.1.0"。 能夠在項目中使用 react-native-elements 中的組件。

當我運行npm start我得到粘貼在下面的錯誤代碼。 我已經通讀了 react-native-elements 文檔,但似乎找不到任何可以幫助我的東西

./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,

我認為你在反應和反應原生之間感到困惑。 如果你想為android和ios平台創建一個本機應用程序,你應該初始化一個react-native項目,我強烈建議你使用react-native cli,因為你可以在你的項目中使用本機代碼,而你最終構建的應用程序也有與世博會相比規模較小。 您的問題是您希望在react項目中編寫react-native代碼。 因此,使用react-native cli再次初始化您的項目。

你不能這樣做(如果你想知道原因,請在這里閱讀)。 你想建立一個網絡應用程序嗎? 將React與create-react-app 你想建立一個移動應用程序嗎? 將React Native與Expo或react-native init

我建議你看一下material-ui作為React的組件庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM