2016-06-03 4 views
3

먼저 반응하고 서로 다른 파일에서 응용 프로그램 밖으로을 통해 이미지를 이미지의지역의 이미지는 내가 코드를 다음과 같이 이미지를로드하려고 네이티브

render(){ 
return(
    <View style={{backgroundColor:'red', flex:1, alignItems:'center'}}> 
    <Text> Landing Page controller</Text> 
    <Image 
    source={require('./symbol.png')} 
    /> 
    </View> 
); } 

enter image description here 지금은이 부하를 많이로드한다. 이 경우 코드와 리소스를 유지하는 것은 매우 어렵습니다. 내가

resource.js

module.export= { 
       symbol:require('./symbol.png'), 
       }; 

을 별도의 파일을 만든 다음 구성 요소 파일에 내가 아래와 같이로드하려고 노력하는 이유입니다.

import JResource from './resource.js'; 
    ..................... 
    .................. 
render(){ 
     return(
      <View style={{backgroundColor:'red', flex:1, alignItems:'center'}}> 
      <Text> Landing Page controller</Text> 
      <Image 
      source={JResource.symbol} 
      /> 
      </View> 
     ); 
     } 

이제 응용 프로그램이 실행되었지만 이미지가 표시되지 않습니다. 어떤 신체가 여기 무엇이 잘못되었는지 알아내는 것이 좋을 것입니다.

enter image description here

답변

1

당신은 module.exports은 = .....

를 내 보내지한다
관련 문제