npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nyby/meteor-react-native

v2.4.1

Published

Full Meteor Client for React Native

Downloads

3

Readme

Meteor React Native

A set of packages allowing you to connect your React Native app to your Meteor server, and take advantage of Meteor-specific features like accounts, reactive data trackers, etc. Compatible with the latest version of React Native.

Check out the @meteorrn github org for more packages, examples, and tutorials.

Full API Documentation

If you're new to React Native, you can view a guide to using React Native with Meteor on the Official Meteor Guide

Installation

  1. npm install --save @meteorrn/core
  2. Confirm you have peer dependencty @react-native-community/netinfo installed
  3. Confirm you have @react-native-async-storage/async-storage@>=1.8.1 installed. If you are using Expo, or otherwise cannot use @react-native-async-storage/async-storage, see Custom Storage Adapter below.
import { AsyncStorage } from 'react-native';

// ...

Meteor.connect("wss://myapp.meteor.com/websocket", { AsyncStorage });

If you are using the AsyncStorage API yourself, its important that you use the same version that MeteorRN is using, or issues could be caused due to the conflicting versions. Make sure you are using the same AsyncStorage you pass into Meteor (or @react-native-async-storage/async-storage if you aren't passing anything), or you can use MeteorRN's package interface.

Basic Usage

import Meteor, { Mongo, withTracker } from '@meteorrn/core';

// "mycol" should match the name of the collection on your meteor server, or pass null for a local collection
let MyCol = new Mongo.Collection("mycol");

Meteor.connect("wss://myapp.meteor.com/websocket"); // Note the /websocket after your URL 

class App extends React.Component {
    render() {
        let {myThing} = this.props;
        
        return (
            <View>
                <Text>Here is the thing: {myThing.name}</Text>
            </View>
        );
    } 
}

let AppContainer = withTracker(() => {
    Meteor.subscribe("myThing");
    let myThing = MyCol.findOne();
    
    return {
        myThing
    };
})(App)

export default AppContainer;

Unique Scenarios: Running the app on a physical device but want to connect to local development machine? Check out this issue comment.

Companion Packages

The @meteorrn/core package has been kept as light as possible. To access more features, you can use companion packages.

Here are some examples:

  • @meteorrn/oauth-google: Allows you to let users login to your app with Google
  • @meteorrn/oauth-facebook: Allows you to let users login to your app with Facebook

For the full list of officially recognized packages, check out the @meteorrn github org.

Compatibility

This package is compatible with React Native versions from 0.60.0 to latest (0.63.2)

For React Native <0.60.0 use react-native-meteor.

Migrating from react-native-meteor:

  • cursoredFind is no longer an option. All .find() calls will return cursors (to match Meteor)
  • MeteorListView & MeteorComplexListView have been removed
  • CollectionFS has been removed
  • createContainer has been removed
  • Mixins (connectMeteor) have been removed
  • composeWithTracker has been removed

Using on Web

While this package was designed with React Native in mind, it is also capable of running on web (using react-dom). This can be useful if you need a light-weight Meteor implementation, if you want to create a client app separate from your server codebase, etc. The only change required is providing an AsyncStorage implementation. Here is a simple example:

const AsyncStorage = {
    setItem:async (key, value) => window.localStorage.setItem(key, value),
    getItem:async (key) => window.localStorage.getItem(key)
    removeItem:async (key) => window.localStorage.removeItem(key)    
}

Meteor.connect("wss://.../websock", {AsyncStorage});

Changelog

The GitHub Releases Tab includes a full changelog

Package Interface

To ensure that MeteorRN companion packages use the same versions of external packages like AsyncStorage as the core, @meteorrn/core provides a package interface, where companion packages can access certain packages. Currently package interface returns an object with the following properties:

  • AsyncStorage

Usage

import Meteor from '@meteorrn/core';

const {AsyncStorage} = Meteor.packageInterface();

Differences from Meteor Core to Note:

  • This API does not implement observeChanges (but it does implement observe)

Showcase

| Whazzup.co | StarlingRealtime | | --- | --- | | | | | Whazzup.co uses Meteor React Native in their native app | StarlingRealtime uses Meteor React Native in their production app |

Meteor React Native is maintained by Nathaniel Dsouza who is available for consultation: [email protected]