Feed
A package for creating a social network style news feed
This is a Meteor package with part of it's code published as a companion NPM package made to work with React Native. This allows your Meteor and React Native projects that use this package to share code between them to give you a competitive advantage when bringing your mobile and web application to market.
- Supporting The Project
- Meteor Installation
- React Native Installation
- Basic Usage
- Scalability - Redis Oplog
Supporting The Project
Finding the time to maintain FOSS projects can be quite difficult. I am myself responsible for over 30 personal projects across 2 platforms, as well as Multiple others maintained by the Meteor Community Packages organization. Therfore, if you appreciate my work, I ask that you either sponsor my work through GitHub, or donate via Paypal or Patreon. Every dollar helps give cause for spending my free time fielding issues, feature requests, pull requests and releasing updates. Info can be found in the "Sponsor this project" section of the GitHub Repo
Meteor Installation
This package relies on the npm package simpl-schema
so you will need to make sure it is installed as well.
meteor npm install --save simpl-schema
meteor add socialize:feed
React Native Installation
When using this package with React Native, the dependency tree ensures that simpl-schema
is loaded so there's no need to install it as when using within Meteor.
npm install --save @socialize/feed
Note
When using with React Native, you'll need to connect to a server which hosts the server side Meteor code for your app using
Meteor.connect
as per the @socialize/react-native-meteor documentation.
Basic Usage
Depending on the environment your code will be running in, you'll need to import the classes from the packages specific to that environment, either Meteor or React Native.
// Meteor Imports
import { Meteor } from 'meteor/meteor';
In the case of use with React-Native, you'll also need to import this package to allow it to extend the User
class properly.
// React Native Imports
import Meteor from '@socialize/react-native-meteor';
import '@socialize/feed';
Once we have the appropriate packages imported, the rest of the code will run in either environment.
Meteor.subscribe('socialize.feed.posts', { limit: 5, sort: { createdAt: -1 } })
Meteor.user().feed().addPost("Just discovered these Socialize packages and they AWESOME!");
For a more in depth explanation of how to use this package see API.md
Scalability - Redis Oplog
This implements cultofcoders:redis-oplog's namespaces to provide reactive scalability as an alternative to Meteor's livedata
. Use of redis-oplog is not required and will not engage until you install the cultofcoders:redis-oplog package and configure it.