在构建应用程序时反应本机意外令牌

时间:2019-02-18 06:11:45

标签: react-native

Capture or error

已完成加载依赖关系图。 错误:捆绑失败:语法错误:/Users/mhd/Documents/Projects/testingscrn/node_modules/react-native/screens/HomeScreen.js:意外令牌(19:3)

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import {createStackNavigator, createAppContainer} from 'react-navigation';


class HomeScreen extends React.Component {
  static navigationOptions = {
    title: 'Welcome',
  };

  render() {
    const {navigate} = this.props.navigation;
    return (
      <Button
        title="Go to Jane's profile"
        onPress={() => navigate('Profile', {name: 'Jane'})}
      />
    );
  }

1 个答案:

答案 0 :(得分:0)

您的课程缺少结尾括号。应该是下面的样子

.....

class HomeScreen extends React.Component {
  static navigationOptions = {
    title: 'Welcome',
  };

  render() {
    const {navigate} = this.props.navigation;
    return (
      <Button
        title="Go to Jane's profile"
        onPress={() => navigate('Profile', {name: 'Jane'})}
      />
    );
  }
}