Skip to content

Commit

Permalink
Removed react-mixin dependancy and exposes connectMeteor decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo mathieu committed Mar 2, 2016
1 parent 9042a04 commit 9c3b207
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ The purpose of this library is :
```javascript

import { View, Text, Component } from 'react-native';
import Meteor, { MeteorMixin } from 'react-native-meteor';
import reactMixin from 'react-mixin';
import Meteor, { connectMeteor } from 'react-native-meteor';

/*
* Uses decorators (see detailed installation to activate it)
Expand All @@ -42,12 +41,12 @@ import reactMixin from 'react-mixin';
class Todos extends Component {
...
}
reactMixin(Todos.prototype, MeteorMixin);
connectMeteor(Todos);
export default Todos;
*/

@reactMixin.decorate(MeteorMixin)
@connectMeteor
export default class App extends Component {
componentWillMount() {
const url = 'http://192.168.X.X:3000/websocket';
Expand Down
5 changes: 2 additions & 3 deletions example/mobile/app/Routes/Status.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import React, {
TouchableHighlight
} from 'react-native';

import Meteor, { MeteorMixin } from 'react-native-meteor';
import reactMixin from 'react-mixin';
import Meteor, { connectMeteor } from 'react-native-meteor';

import Button from 'react-native-button';


@reactMixin.decorate(MeteorMixin)
@connectMeteor
export default class Status extends Component {
getMeteorData() {
return {
Expand Down
8 changes: 4 additions & 4 deletions example/mobile/app/Routes/Todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import React, {
TabBarIOS
} from 'react-native';

import Meteor, { MeteorMixin } from 'react-native-meteor';
import reactMixin from 'react-mixin';
import Meteor, { connectMeteor } from 'react-native-meteor';


@reactMixin.decorate(MeteorMixin)
export default class Todos extends Component {
class Todos extends Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -61,6 +59,8 @@ export default class Todos extends Component {
);
}
}
connectMeteor(Todos)
export default Todos;

const styles = StyleSheet.create({
container: {
Expand Down
1 change: 0 additions & 1 deletion example/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react-mixin": "^3.0.3",
"react-native": "^0.20.0",
"react-native-button": "^1.4.2",
"react-native-meteor": "^1.0.0-beta1",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-meteor",
"version": "1.0.0-beta1",
"version": "1.0.0-beta2",
"description": "DDP React-native Client",
"main": "src/Meteor.js",
"scripts": {
Expand Down Expand Up @@ -29,6 +29,7 @@
"ddp.js": "1.1.0",
"ejson": "^2.1.2",
"minimongo-cache": "0.0.48",
"react-mixin": "^3.0.3",
"trackr": "^2.0.2"
}
}
4 changes: 3 additions & 1 deletion src/Meteor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import Mixin from './Mixin';
import User from './User';

module.exports = {
MeteorMixin: Mixin,
connectMeteor(reactClass) {
return reactMixin.onClass(reactClass, Mixin);
},
collection(name) {
return {
find(selector, options) {
Expand Down

0 comments on commit 9c3b207

Please sign in to comment.