react-native-meteor
Advanced tools
Comparing version 1.0.0-beta15 to 1.0.0-beta16
@@ -1,1 +0,49 @@ | ||
Doc incoming | ||
# Implementation for Meteor-CollectionFS | ||
## Example usage | ||
```javascript | ||
@connectMeteor | ||
export default class ImageFS extends Component { | ||
startMeteorSubscriptions() { | ||
Meteor.subscribe('imagesFiles'); | ||
} | ||
getMeteorData() { | ||
return { | ||
image: Meteor.FSCollection('imagesFiles').findOne() | ||
} | ||
} | ||
render() { | ||
const { image } = this.data; | ||
if(!image) return null; | ||
return ( | ||
<Image | ||
style={{height: 400, width: 400}} | ||
source={{uri: image.url()}} | ||
/> | ||
); | ||
} | ||
} | ||
``` | ||
## Available methods on FSFile | ||
All methods accept an optional parameter to choose another store. Example `file.url({store: 'thumbnail'})` | ||
* url([store]) | ||
* isImage([store]) | ||
* isVideo([store]) | ||
* isAudio([store]) | ||
* isUploaded([store]) | ||
* name([store]) | ||
* extension([store]) | ||
* size([store]) | ||
* type([store]) | ||
* updatedAt([store]) | ||
## Something wrong or missing ? | ||
Please create an issue or make a PR ;) | ||
@@ -13,3 +13,3 @@ # Android | ||
## With RN >= 0.20.0 (Babel 6) | ||
## With RN >= 0.16.0 (Babel 6) | ||
@@ -26,7 +26,2 @@ - `npm i --save-dev babel-plugin-transform-decorators-legacy babel-preset-react-native` in your project | ||
## With RN >= 0.16.0 && <= 0.19.0 (Babel 6) | ||
Looking for your help. The RN 0.20.0 solution might be working, please let me know ;) | ||
## With RN <0.16.0 (Babel 5) | ||
@@ -33,0 +28,0 @@ |
{ | ||
"name": "react-native-meteor", | ||
"version": "1.0.0-beta15", | ||
"version": "1.0.0-beta16", | ||
"description": "DDP React-native Client", | ||
@@ -5,0 +5,0 @@ "main": "src/Meteor.js", |
@@ -15,3 +15,3 @@ [](https://badge.fury.io/gh/inProgress-team%2Freact-native-meteor) | ||
Meteor-like methods for React Native. **Currently in v1.0.0-beta15** ! For old docs, see [v0.6.2 documentation](https://github.com/inProgress-team/react-native-meteor/tree/0.6.2) (classic ddp interface). | ||
Meteor-like methods for React Native. **Currently in v1.0.0-beta16** ! For old docs, see [v0.6.2 documentation](https://github.com/inProgress-team/react-native-meteor/tree/0.6.2) (classic ddp interface). | ||
@@ -164,2 +164,4 @@ ## What is it for ? | ||
* [Accounts.createUser](http://docs.meteor.com/#/full/accounts_createuser) | ||
* [Accounts.changePassword](http://docs.meteor.com/#/full/accounts_forgotpassword) | ||
* [Accounts.forgotPassword](http://docs.meteor.com/#/full/accounts_changepassword) | ||
@@ -166,0 +168,0 @@ ## Meteor.ddp |
@@ -39,7 +39,7 @@ 'use strict'; | ||
const items = Data.db.observe(() => { | ||
this.items = Data.db.observe(() => { | ||
return Data.db[collection].find(selector, options); | ||
}); | ||
items.subscribe(results=>{ | ||
this.items.subscribe(results=>{ | ||
this.setState({ | ||
@@ -50,2 +50,5 @@ ds: this.state.ds.cloneWithRows(results) | ||
} | ||
componentWillUnmount() { | ||
this.items.dispose(); | ||
} | ||
render() { | ||
@@ -52,0 +55,0 @@ const { ds } = this.state; |
@@ -24,3 +24,3 @@ import minimongo from 'minimongo-cache'; | ||
}, | ||
offChange() { | ||
offChange(cb) { | ||
this.db.off('change', cb); | ||
@@ -27,0 +27,0 @@ this.ddp.off('connected', cb); |
@@ -0,1 +1,2 @@ | ||
import Data from '../Data'; | ||
import call from '../Call'; | ||
@@ -7,3 +8,3 @@ import User from './User'; | ||
module.exports = { | ||
createUser(options, callback) { | ||
createUser(options, callback = ()=>{}) { | ||
if (options.username) options.username = options.username; | ||
@@ -21,5 +22,30 @@ if (options.email) options.email = options.email; | ||
typeof callback == 'function' && callback(err); | ||
callback(err); | ||
}); | ||
}, | ||
changePassword(oldPassword, newPassword, callback = ()=>{}) { | ||
//TODO check Meteor.user() to prevent if not logged | ||
if(typeof newPassword != 'string' || !newPassword) { | ||
return callback("Password may not be empty"); | ||
} | ||
call("changePassword", | ||
oldPassword ? hashPassword(oldPassword) : null, | ||
hashPassword(newPassword), | ||
(err, res) => { | ||
callback(err); | ||
}); | ||
}, | ||
forgotPassword(options, callback = ()=>{}) { | ||
if (!options.email) { | ||
return callback("Must pass options.email"); | ||
} | ||
call("forgotPassword", options, err => { | ||
callback(err); | ||
}); | ||
} | ||
} |
42177
979
183