0
<Image source={require('./cat.jpeg')}/> 

に反応しますか 画像cat.jpegは、現在のコンポーネントと同じフォルダにあります。ここでで<image >タグが付けられたラインで予期しないトークンは、私は、レンダリング関数内の行を持っている、と私は、コードを実行したとき、私はこれを解決するために、このline.Howでエラー予期しないトークンを取得?ネイティブ

は完全なコードです:

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

import { Actions } from 'react-native-router-flux'; 


export default class HomeScreen extends Component{ 



    render() { 
    return (
      <View style={styles.container}> 
      <View style={styles.rowcontainer}> 
      // <Image style={{width: 50, height:50}} 
      // source={{uri: 'https://facebook.github.io/react/img/logo_small.png'}}/> 
      <Image source={require('./cat.jpeg')}/> 

      <Text onPress={Actions.MarkAttendance}style={styles.welcome}> 
      Mark Attendance 
     </Text> 


     <Text onPress={Actions.AttendanceDetails}style={styles.welcome}> 
      View Attendance 
     </Text> 

     </View> 

     <View style={styles.rowcontainer}> 

     <Text onPress={Actions.Test}style={styles.welcome}> 
      Test 
     </Text> 


     <Text onPress={Actions.NewActivation}style={styles.welcome}> 
      New Activation 
     </Text> 

     </View> 
     <View style={styles.rowcontainer}> 

     <Text onPress={Actions.PendingAttendance}style={styles.welcome}> 
      Pending Attendance 
     </Text> 


     <Text onPress={Actions.Checkout}style={styles.welcome}> 
      Checkout 
     </Text> 

     </View> 
     <View style={styles.rowcontainer}> 

     <Text onPress={Actions.Settings}style={styles.welcome}> 
      Settings 
     </Text> 

     <Text style={styles.welcome}> 
      Logout 
     </Text> 

     </View> 
     </View> 
     ) 

    } 


} 


var styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    marginTop:50, 
    backgroundColor: '#FFFFFF', 
    }, 
    rowcontainer:{ 
    alignItems:'stretch', 
    flexDirection:'row', 
    justifyContent:'space-between', 
    margin: 10, 
    }, 
    welcome:{ 
    fontSize:15, 
    } 
}); 
+0

パッケージャを再起動しましたか? – stinodes

+0

はい、それは助けになりません –

+0

あなたの質問には、その場合、いくつかのコードを追加できますか?その行はうまくいくようです。あなたはどこか別の場所で括弧を忘れているかもしれません。 – stinodes

答えて

1

あなたがHTMLに似た構文を使用している間、あなたのレンダリング機能の内部コードの一部をコメントアウトする//を使用することはできません。 代わりに、{}の中でコメントアウトしようとしているものをラップし、そこにjavascriptのブロックコメントを使用してみてください。

{/* 
    <Image 
     source=.../> 
*/} 
+0

私はこれをimport {Image} 「反応原産」から;答えは –

+0

あなたのアプリを稼動させるには確かに役立ちましたが、欠落している変数/インポートが予期しないトークンと同じではないため、別のエラーが発生しました。 しかし、助けて嬉しいです。 – stinodes

関連する問題