-
Notifications
You must be signed in to change notification settings - Fork 51
/
DigitsLogoutButton.js
40 lines (33 loc) · 1 KB
/
DigitsLogoutButton.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React, { Component } from 'react';
import { NativeModules, Text, TouchableHighlight } from 'react-native';
class DigitsLogoutButton extends Component {
constructor(props) {
super(props);
this.buttonPressed = this.buttonPressed.bind(this);
this.getSessionDetails = this.getSessionDetails.bind(this);
}
getSessionDetails(callback) {
NativeModules.DigitsManager.sessionDetails((error, sessionDetails) => {
if (error) {
console.error(error);
} else {
callback(sessionDetails);
}
});
}
buttonPressed() {
NativeModules.DigitsManager.logout();
this.props.completion(null, {});
}
render() {
return (
<TouchableHighlight style={this.props.buttonStyle} underlayColor={this.props.highlightColor} onPress={this.buttonPressed} >
<Text style={this.props.textStyle}>{this.props.text}</Text>
</TouchableHighlight>
);
}
}
DigitsLogoutButton.defaultProps = {
highlightColor: 'black',
};
module.exports = DigitsLogoutButton;