react-native-account-kit
v0.1.0
Published
React Native Account Kit for Android and iOS (soon)
Downloads
9
Maintainers
Readme
react-native-account-kit
React Native Account Kit for Android and iOS (soon)
Installation
npm install react-native-account-kit subscribable --save
Configure native projects
Android
iOS
How to use it
...
import React, {
DeviceEventEmitter
} from 'react-native';
import AccountKit from 'react-native-account-kit';
var Subscribable = require('subscribable');
var AK = new AccountKit();
...
class MyProject extends Component {
...
constructor(props, context) {
super(props, context);
AK.getCurrentAccessToken()
.then(function (at) {
console.log(at);
})
.fail(function (e) {
console.log(e);
});
AK.getCurrentAccount()
.then(function (account_info) {
console.log(account_info);
})
.fail(function (e) {
console.log(e);
});
}
mixins = [Subscribable.Mixin];
...
}
- To call the Login/Register View
AK.loginWithPhone(); // Expects as Response Type a TOKEN by Default
//AK.loginWithPhone(AK.RESPONSE_TYPE_CODE); // Set the response type as TOKEN if you need it
//Now we need to set the listener for the successful login
componentWillMount() {
DeviceEventEmitter.addListener('AccountKitLogged', function (e:Event) {
console.log(e); // Will have the token/code information
});
}
}