0

地圖我收到此錯誤:無法讀取屬性「的未定義

無法讀取屬性未定義新 index.android.bundle平臺=機器人&開發=假&熱=假&的地圖「?縮小=假:87221:34 ReactCompositeComponentWrapper._constructComponentWithoutOwner index.android.bundle平臺=機器人& dev的= FALSE &熱=假&縮小=假:31251:30 ReactCompositeComponentWrapper._constructComponent?index.android.bundle平臺=機器人&開發=假&熱=假&縮小= FALSE:31247:21 ReactCompositeComponentWrapper.mountComponent index.android.bundle平臺=機器人&開發=假&熱=假&縮小= FALSE:31231:25 Object.mountComponent index.android.bundle平臺=機器人&開發=假&熱=假&縮小= FALSE:30937:39 Object.updateChildren index.android.bundle平臺=機器人& dev = false & hot = false & minify = false:3 2163:69個 Constructor._reconcilerUpdateChildren index.android.bundle平臺=機器人&開發=假&熱=假&縮小= FALSE:32271:119個 Constructor._updateChildren index.android.bundle平臺=機器人&開發=假&熱=假&縮小=假:32308:33 Constructor.updateChildren index.android.bundle平臺=機器人& dev的= FALSE &熱=假&縮小=假:32302:14 Constructor.receiveComponent 索引。 android.bundle?platform = android & d EV =假&熱=假&縮小= FALSE:32375:119

main.js

import icons from './icons'  

    type Cell = { 
     image: any, 
     animation: any 
    }; 

    export default class Camera extends React.Component { 
     cells: Cell[]; 
     background = new Animated.Value(HIDDEN); 
     text = new Animated.Value(HIDDEN); 
     state: { focused?: Cell } = {}; 

     constructor(props) { 

     super(props); 
     this.cells = icons.map((icon) => ({ 
      ...icon, animation: new Animated.Value(HIDDEN) 
     })); 


     } 

icons.js

import React from 'react'; 
import Icon from 'react-native-vector-icons/Octicons' 
import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons' 

const icons =[ 
    { name: 'Notes', image: <Icon name='device-camera' />}, 
    { name: 'Earth', image: <SimpleLineIcons name='camera' /> } 
] 

export { icons } 
+1

你有沒有登錄'圖標',看起來像是'undefined' – adeneo

+0

@adeneo yea,它的顯示不確定,不知道爲什麼? –

+2

然後從'。/ icons''導入圖標可能不會做你認爲它正在做的事情。 – adeneo

回答

3

export default icons;icons.js應該做的伎倆。

+0

我試過了,但沒有工作,今天又試了一遍,它開始工作。一個知道發生了什麼,爲什麼!! –

+0

哈哈。你必須愛JS,它的怪癖:P –

相關問題