inProgress-team / inProgress-team/react-native-meteor

React-Native Meteor Subscription to publication never ready

Open
#223 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
688
Forks
200
PR merge metrics
No merged PRs in 30d

Description

I am trying to subscribe to a publication in a webscoket using meteor, but subscription is never ready. I have tried to print contents of collection, but due to failure to subscribe, it has nothing. here is the code i have tried.

`/ @flow
'use strict'

import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
View,
Text,
} from 'react-native'
import Meteor, {
createContainer,
MeteorListView,
} from 'react-native-meteor'

Meteor.connect('ws://durbintest.pro/websocket')

class AwesomeProject extends Component {

renderItem(Do){
return(
{Do}
)
}

render() {

const { doList, } = this.props

return (

{!doList && Not ready with subscription}


)
}

}

const styles = StyleSheet.create({
container: {
flex:1,
}
});

export default createContainer(params=>{
const handle = Meteor.subscribe('fetch.news');
console.log(handle.ready()); //RETURNS FALSE ALWAYS
return {
doList: handle.ready(),
};
}, AwesomeProject)

AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.