-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathApp.js
55 lines (49 loc) · 1.1 KB
/
App.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Ethereum Wallet React Native App
*
* @author Huseyin RAN
*/
import React, { Component } from 'react';
import { StyleSheet, View, AsyncStorage } from 'react-native';
import Home from './src/navigation/index';
import Welcome from './src/containers/Welcome';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
isSignedIn: false
}
this.checkWallet = this.checkWallet.bind(this);
}
componentDidMount() {
console.log(this.props);
this.checkWallet();
}
/**
* @method to check wallet in Localstorage
*/
async checkWallet() {
try {
const value = await AsyncStorage.getItem('account');
console.log(value);
if (value == null) {
} else {
this.setState({ isSignedIn: true });
}
} catch (error) {
console.log(error);
}
}
render() {
return (
<View style={styles.container}>
{ this.state.isSignedIn ? (<Home/>) : (<Welcome checkWallet={this.checkWallet} />) }
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1
}
});