Cookie manager for react native.
npm install react-native-cookies
- In the XCode's "Project navigator", right click on project name folder ➜
Add Files to <...>
- Ensure
Copy items if needed
andCreate groups
are checked
- Go to
node_modules
➜react-native-cookies
➜ addRNCookieManagerIOS
folder - Compile and have some cookies
var CookieManager = require('react-native-cookies');
// set a cookie
CookieManager.set({
name: 'myCookie',
value: 'myValue',
domain: 'some domain',
origin: 'some origin',
path: '/',
version: '1',
expiration: '2015-05-30T12:30:00.00-05:00'
}, (err, res) => {
console.log('cookie set!');
console.log(err);
console.log(res);
});
// list cookies
CookieManager.getAll((err, res) => {
console.log('cookies!');
console.log(err);
console.log(res);
});
// clear cookies
CookieManager.clearAll((err, res) => {
console.log('cookies cleared!');
console.log(err);
console.log(res);
});
- Expose
get
method - Proper
getAll
dictionary by domain - Proper error handling
- Anything else?
PR's welcome!