2017-02-21 1 views
1

네이티브, 네이티브베이스 및 Exponent를 대처하는 데 상당히 익숙합니다. 불행히도 간단한 구성 요소를 표시하는 데 어려움을 겪고 있습니다. 네이티브베이스 설명서에서 간단한 튜토리얼 구성 요소 문제를 해결하는 데 아마 6 시간 이상을 소비했습니다. 나는 근본적인 무언가를 놓치고있는 것처럼 느껴지고 나는 정말로 도움의 손길에 감사 할 것입니다.React Native + NativeBase + Exponent, 요소 유형이 잘못되었습니다.

다음은 내가하고있는 것입니다 : Exponent XDE를 사용하여 프로젝트를 실행하십시오. 설명서에 따라 설치된 원시 데이터베이스. 오류가 없습니다.

main.js

'use strict'; 
import React, { Component } from 'react'; 
import { 
    AppRegistry, 
} from 'react-native'; 
import { Container } from 'native-base'; 
import { CardImageExample } from './component/card.js'; 



AppRegistry.registerComponent('main',() => CardImageExample); 

card.js

import React, { Component, Image } from 'react'; 
import { Container, Content, Card, CardItem, Thumbnail, Text, Icon } from 'native-base'; 

class CardImageExample extends Component { 
    render() { 
     return (
      <Container> 
       <Content> 
        <Card> 
         <CardItem> 
          <Thumbnail source={require('./img/penguin-icon.png')} /> 
          <Text>Instrumental Songs</Text> 
          <Text note>Guitar</Text> 
         </CardItem> 

         <CardItem>       
          <Image style={{ resizeMode: 'cover' }} source={require('./img/penguin.jpg')} /> 
         </CardItem> 

         <CardItem> 
          <Icon name='ios-musical-notes' style={{color : '#ED4A6A'}} /> 
          <Text>Listen now</Text>       
         </CardItem> 
        </Card> 
       </Content> 
      </Container> 
     ); 
    } 
} 
export default CardImageExample; 

현재 오류 : 요소 유형이 유효하지 않습니다 : (내장 구성 요소) 문자열 예상 또는 클래스/기능 (대한 composite components)) : gotdefined : undefined

어디에서 시작해야할지 전혀 알지 못합니다. 감사.

답변

0

귀하의 main.js이 나를 도와

import * as Exponent from 'exponent'; 
import React from 'react'; 
import First from './src/app'; 
import { Container, Header, Title, Content, Button, Left, Right, Body,Icon, Separator } from 'native-base'; 

class App extends React.Component { 
render() { 
    return <First/> ; 
} 
} 
Exponent.registerRootComponent(App); 
+0

처럼 어떤 것을 좋아한다. 감사! – Darthmaul

관련 문제