首页 > ReactNative iOS AwesomeProject 报错

ReactNative iOS AwesomeProject 报错

ReactNative按照官方代码写hello world代码,报syntaxError index.ios.js:unexpected token (35:4)

附上代码

    /**
     * Sample React Native App
     * https://github.com/facebook/react-native
     */
    
    import React, {
      AppRegistry,
      Component,
      Image,
      StyleSheet,
      Text,
      View,
    } from 'react-native';
    
    var MOCKED_MOVIES_DATA = [
      {title: 'Title', year: '2015', posters: {thumbnail: 'http://i.imgur.com/UePbdph.jpg'}},
    ];
    
    
    class AwesomeProject extends Component {
      render() {
        var movie = MOCKED_MOVIES_DATA[0];
        return (
          <View style={styles.container}>
            <Text>{movie.title}</Text>
            <Text>{movie.year}</Text>
            <Image
              source={{uri: movie.posters.thumbnail}}
              style={styles.thumbnail}
            />
          </View>
        );
      }
    
    var styles = StyleSheet.create({
      container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
      },
      thumbnail: {
        width: 53,
        height: 81,
      },
    });
    
    AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

少一个反大括号,这么低级的错误。

【热门文章】
【热门文章】