0

After publishing data and subscribing from react native client,it takes about a minute to make subscribtion ready.If i update collection it takes again about a minute to get data and fire componentWillReceiveProps(newProps) method.Collection has only few documents.

Meteor Server Code:

import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { ArtWorks } from './database/artworks';
import { Gallerys } from './database/gallerys';
import { PlayerData } from './database/playerdata';
import { Questions } from './database/questions';
import { Relics } from './database/relics';
import { RelicsOnMap } from './database/relicsonmap';



Meteor.startup(() => {





});
Meteor.publish('getRelicsOnMap', function getRelicsOnMap (){

  console.log("publishing...")
      return RelicsOnMap.find({});


    }); 

RelicsOnMap collection:

import { Mongo } from 'meteor/mongo';

export const RelicsOnMap =  new Mongo.Collection('relicsonmap');

Client:

import React, { Component } from 'react';
import { View } from 'react-native';
import {
    Container,
    Header,
    Title,
    Content,
    Button,
    Item,
    Input,
    Body,
    Left,
    Right,
    Icon,
    Form,
    Text,
    Spinner,
    Toast 
  } from "native-base";
  import Meteor,{withTracker} from 'react-native-meteor';


 class ProfileScreen extends Component {
    constructor(props) {
        super(props);
    this.userData;

        this.state = {


        };
      }

    componentDidMount(){
     console.log(this.props)
    }
    componentWillReceiveProps(newProps){
        console.log(newProps)
    }




  render() {
    return (
        <Container> 
      <Text>This is Profile screen</Text>
      <Text>This is Profile screen</Text>




        </Container>
    );
  }

}
export default withTracker(params => {
    Meteor.subscribe('getRelicsOnMap');

     return {
       relicsOnMap: Meteor.collection('relicsonmap').find({})
     };
   })(ProfileScreen);

I do Meteor.connect in another component and its succesfull. Here there is a small video me demonstrating the problem: http://sendvid.com/v5fqlurh

l0veisreal
  • 179
  • 5
  • 20

1 Answers1

0

I found out that react natives remote debugger causes this problem.When im not connected to my local network for debugging through google chrome,everything is fine.I guess this is a bug.

l0veisreal
  • 179
  • 5
  • 20