2017-11-20 5 views
0

RN app + Meteor App을 백엔드로 사용하고 있습니다.Meteor를 사용하여 React Native에 목록 표시

게시가 유성에서 설정

> 서버> 간행물 :

Meteor.publish('deputies',() => { 
    return Deputies.find({}); 
    }); 

서브 스크립은

class Deputies_List extends Component{ 

    render(){ 
    const {deputies}= this.props; 

    return(
     <View> 
      {this.props.deputies.map(deputy=><DeputyDetail deputy={deputy} key={deputy._id}/>)} 
     </View> 
    ); 
    } 
} 


export default createContainer(params=>{ 
    return{ 
    deputies: Meteor.collection('deputies').find({}), 
    }; 

},Deputies_List) 

여기서 RN> DeputiesList에서 설정 DeputyDetail 성분이다 :

const DeputyDetail =({deputy})=>{ 

    const{name} = deputy; 

    return(
    <Text>Nom : {name}</Text> 
    ); 

} 


export default DeputyDetail; 

오류 : 메시지가 표시되지 않지만 화면에 아무것도 표시되지 않습니다. 하나의 항목이 있어야합니다.

아이디어가 있으십니까?

+0

이 변경 const DeputyDetail = ({대리}) => { const {name} = 대리인; 이 CONST에 DeputyDetail = ({이름}) =이> { – iiro

답변

0

코드에서 사용자가 deputies 게시에 가입 한 것으로 나타나지 않습니다. 제 생각에 번으로 createContainer 번으로 전화하면 예상되는 데이터를 볼 수 있습니다.

+0

그래서 같은 Meteor.subscribe을 추가,하지만 차이 수출 기본 createContainer (PARAMS => { Meteor.subscribe ('대리인'); 반환 { 대리인을 : Meteor.collection ('대리인'). 찾기 ({}), }; }, Deputies_List) – Sonia