-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathApp.js
63 lines (51 loc) · 1.32 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
56
57
58
59
60
61
62
63
/* @flow */
import * as React from 'react';
// $FlowFixMe
import 'babel-preset-react-native-web3/globals';
import HDWalletProvider from 'truffle-hdwallet-provider';
import { createMaterialTopTabNavigator } from 'react-navigation';
import Web3 from 'web3';
import Main from './src/Candidates/Main';
import Container from './src/Container';
import Stats from './src/Stats';
import truffleConfig from './truffle';
const network = truffleConfig.networks.ropsten;
const TESTRPC_ADDRESS = `${network.protocol}://${network.host}/`;
const mnemonic = 'YOUR_MNEMONIC_HERE'; // 12 word mnemonic
const web3Provider = new HDWalletProvider(mnemonic, TESTRPC_ADDRESS);
const web3 = new Web3(web3Provider);
class MainScreen extends React.PureComponent<{}> {
static navigationOptions = {
tabBarVisible: false,
};
render() {
return <Main web3={web3} />;
}
}
class SetupScreen extends React.PureComponent<{}> {
static navigationOptions = {
tabBarVisible: false,
};
render() {
return <Stats web3={web3} />;
}
}
export default class App extends React.PureComponent<{}> {
render() {
return (
<Container>
<AppNavigation />
</Container>
);
}
}
const AppNavigation = createMaterialTopTabNavigator(
{
Main: { screen: MainScreen },
Setup: { screen: SetupScreen },
},
{
animationEnabled: true,
swipeEnabled: true,
}
);