意外的令牌,预期}

时间:2017-06-02 17:42:56

标签: react-native

运行我的应用程序时出现“Unexpected Token,expected}”错误。 我试图寻找这个问题,但找不到解决方案。 好像这里的一切都很好:

import React from 'react';
import { Platform, StyleSheet, Button } from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { TabNavigator } from 'react-navigation';

const myNavScreen = ({navigation})=>(
  <View style={styles.container}>
    <Button onPress={()=>navigation.navigate("Home")}
            title="Go to Home"/>
    <Button onPress={()=>navigation.navigate("Friends")}
            title="Go to Friends"/>
    <Button onPress={()=>navigation.goBack(null)}
            title="Go Back"/>
  <View/>
);

const MyHomeScreen = ({navigation})=>(
  <myNavScreen navigation={navigation}/>
);

MyHomeScreen.navigationOptions={
  tabBarLabel: 'Home',
  tabBarIcon: ({tintColor, focused}) =>(
    <Ionicons
      name={focused? 'ios-home' : 'ios-home-outline'}
      size={26}
      style={{color: tintColor}}
    />
  ),
};

const MyFriendsScreen = ({navigation})=>(
  <myNavScreen navigation={navigation}/>
);

MyFriendsScreen.navigationOptions={
  tabBarLabel: 'My Friends',
  tabBarIcon: ({tintColor, focused})=>(
    <Ionicons
      name={focused? 'ios-people' : 'ios-people-outline'}
      size={26}
      style={{color: tintColor}}
    />
  ),
};

const SimpleTabs = TabNavigator({
    Home:{
      screen: MyHomeScreen,
      path:'',
    },
    Friends:{
      screen: MyFriendsScreen,
      path: 'cart',
    },
  },
  {
    tabBarOptions:{
      activeTintColor: Platform.OS === 'ios' ? '#e91e63' : '#fff',
    },
  }
);

const styles = StyleSheet.create({
  container: {
    marginTop: Platform.OS === 'ios' ? 20  : 0,
  },
});

export default SimpleTabs;

它说问题出现在MyHomeScreen.navigationOptions块中,但试图删除它只是在另一个代码块中导致同样的问题。 我在语法中寻找缺失}或其他任何错误,但找不到任何东西。

我在这里缺少什么?

1 个答案:

答案 0 :(得分:1)

您忘记删除逗号

.setsockopt( ZMQ_IMMEDIATE )

一切都会好起来的。)