SyntaxError:意外的令牌导入React Native

时间:2018-04-30 00:42:11

标签: react-native react-native-android react-navigation

正在按要求执行的App.js文件

import React from 'react';
import { Image, StyleSheet, Text, View, KeyboardAvoidingView, TouchableOpacity, AppRegistry} from 'react-native';
import { StackNavigator } from 'react-navigation';
import Instabug from 'instabug-reactnative'; 

import LoginScreen from './Screens/LoginScreen';
import HomeScreen from './Screens/HomeScreen';
import ChatUIScreen from './Screens/ChatUIScreen';
import PaymentScreen from './Screens/PaymentScreen';
import AppointmentScreen from './Screens/AppointmentScreen';


export default class App extends React.Component {
  render() {
    return (
      <AppNavigator />
    );
  } 
}

  const AppNavigator = StackNavigator({
    LoginScreen: {screen: LoginScreen},
    HomeScreen: {screen: HomeScreen},
    ChatUI: {screen:ChatUIScreen},
    Appointment:{screen:AppointmentScreen},
    Payment: {screen:PaymentScreen},
    AppointmentPayInfo: {screen:AppointmentPayInfo}
  })

AppRegistry.registerComponent('Modelfy',()=> AppNavigator);

export default AppNavigator;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#7739ac',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

package.json文件:按要求

  {   "main": "node_modules/expo/AppEntry.js",   "private": true,   "dependencies": {
        "expo": "^26.0.0",
        "react": "16.3.0-alpha.1",
        "react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz"   },  "devDependencies": {
        "babel-cli": "^6.26.0",
        "babel-preset-react": "^6.24.1"   } }

在VSC中执行时的错误代码

Error from output

我是React Native的新手,这里出现的错误代码,我已经尝试更新Babel文件但是没有用。

0 个答案:

没有答案