2017-04-09 8 views
0

私はそれがeroorにF:/ReactNativeProject/FirstProject/index.android.js: Unexpected token, expected ((23:8) at F:\ReactNativeProject\FirstProject\index.android.js:23:8 onResponse DevServerHelper.java:330 execute RealCall.java:126 run NamedRunnable.java:32 runWorker ThreadPoolExecutor.java:1112 run ThreadPoolExecutor.java:587 run Thread.java:818 一部を示してコンパイルするとき、私は、2 TextViewImageViewを設定するために単純な参照を取ります1は私にEroor:F:/ReactNativeProject/FirstProject/index.android.js:予想予期しないトークン、((23:8)

import React, { Component,} from 'react'; 
import { AppRegistry, Image, StyleSheet, Text, View,} from 'react-native'; 

var MOKCKED_MOVIES_DATA=[ 
    {title:'Title' , year:'2017' , posters:{thumbnail:'http://i.imgur.com/UePbdph.jpg'}}, 
]; 


class SampleAppMovies extends Component{ 
render(){ 
    var movie=MOKCKED_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('FirstProject',() => SampleAppMovies); 

?間違っているとエラーが反応ネイティブを使用しているとき、私はよくエラーを見つけるのですか、コード行が表示されない?

+0

'index.android.js:23:8'でエラーを表示します –

+0

正確に23:8とは何ですか?それは、23時のコード行を意味しますか? –

+0

index.android.jsの23行目と8番目の文字 –

答えて

1
は外のスタイル宣言を移動し

私のコードを教えることができますコンポーネント

import React, { Component,} from 'react'; 
import { AppRegistry, Image, StyleSheet, Text, View,} from 'react-native'; 

var MOKCKED_MOVIES_DATA=[ 
    {title:'Title' , year:'2017' , posters:{thumbnail:'http://i.imgur.com/UePbdph.jpg'}}, 
]; 


class SampleAppMovies extends Component{ 
render(){ 
    var movie=MOKCKED_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('FirstProject',() => SampleAppMovies); 
+0

あなたの答えのためにちょっと男、ありがとう。 –

関連する問題