|
1 |
| -import React, { Component } from 'react'; |
| 1 | +import React from 'react'; |
2 | 2 | import { observer } from 'mobx-react';
|
3 | 3 | import PropTypes from 'prop-types';
|
4 | 4 | import SeedEntry from '../component/seed-entry';
|
@@ -40,58 +40,46 @@ const styles = createStyles(
|
40 | 40 | })
|
41 | 41 | );
|
42 | 42 |
|
43 |
| -class RestoreSeedView extends Component { |
44 |
| - constructor(props) { |
45 |
| - super(props); |
46 |
| - this.state = { |
47 |
| - focusedInput: 0, |
48 |
| - }; |
49 |
| - } |
50 |
| - |
51 |
| - render() { |
52 |
| - const { store, wallet } = this.props; |
53 |
| - return ( |
54 |
| - <Background image="purple-gradient-bg"> |
55 |
| - <Header> |
56 |
| - <BackButton onPress={() => wallet.initPrevRestorePage()} /> |
57 |
| - <Button disabled onPress={() => {}} /> |
58 |
| - </Header> |
59 |
| - <MainContent style={styles.content}> |
60 |
| - <CopyOnboardText style={styles.title}> |
61 |
| - {'Restore your wallet'} |
62 |
| - </CopyOnboardText> |
63 |
| - <Card> |
64 |
| - <FormSubText style={styles.subText}> |
65 |
| - {store.restoreVerifyCopy} |
66 |
| - </FormSubText> |
67 |
| - {store.restoreVerifyIndexes.map((seedIndex, i) => ( |
68 |
| - <SeedEntry |
69 |
| - seedIndex={seedIndex} |
70 |
| - value={store.seedMnemonic[seedIndex - 1]} |
71 |
| - onChangeText={word => |
72 |
| - wallet.setRestoreSeed({ word, index: seedIndex - 1 }) |
73 |
| - } |
74 |
| - key={i} |
75 |
| - autoFocus={seedIndex - 1 === store.wallet.focusedRestoreInd} |
76 |
| - onSubmitEditing={() => |
77 |
| - i === 2 |
78 |
| - ? wallet.initNextRestorePage() |
79 |
| - : wallet.setFocusedRestoreInd({ index: seedIndex }) |
80 |
| - } |
81 |
| - onClick={() => |
82 |
| - wallet.setFocusedRestoreInd({ index: seedIndex - 1 }) |
83 |
| - } |
84 |
| - /> |
85 |
| - ))} |
86 |
| - </Card> |
87 |
| - <SmallGlasButton onPress={() => wallet.initNextRestorePage()}> |
88 |
| - Next |
89 |
| - </SmallGlasButton> |
90 |
| - </MainContent> |
91 |
| - </Background> |
92 |
| - ); |
93 |
| - } |
94 |
| -} |
| 43 | +const RestoreSeedView = ({ store, wallet }) => ( |
| 44 | + <Background image="purple-gradient-bg"> |
| 45 | + <Header> |
| 46 | + <BackButton onPress={() => wallet.initPrevRestorePage()} /> |
| 47 | + <Button disabled onPress={() => {}} /> |
| 48 | + </Header> |
| 49 | + <MainContent style={styles.content}> |
| 50 | + <CopyOnboardText style={styles.title}> |
| 51 | + Restore your wallet |
| 52 | + </CopyOnboardText> |
| 53 | + <Card> |
| 54 | + <FormSubText style={styles.subText}> |
| 55 | + {store.restoreVerifyCopy} |
| 56 | + </FormSubText> |
| 57 | + {store.restoreVerifyIndexes.map((seedIndex, i) => ( |
| 58 | + <SeedEntry |
| 59 | + seedIndex={seedIndex} |
| 60 | + value={store.seedMnemonic[seedIndex - 1]} |
| 61 | + onChangeText={word => |
| 62 | + wallet.setRestoreSeed({ word, index: seedIndex - 1 }) |
| 63 | + } |
| 64 | + key={i} |
| 65 | + autoFocus={seedIndex - 1 === store.wallet.focusedRestoreInd} |
| 66 | + onSubmitEditing={() => |
| 67 | + i === 2 |
| 68 | + ? wallet.initNextRestorePage() |
| 69 | + : wallet.setFocusedRestoreInd({ index: seedIndex }) |
| 70 | + } |
| 71 | + onClick={() => |
| 72 | + wallet.setFocusedRestoreInd({ index: seedIndex - 1 }) |
| 73 | + } |
| 74 | + /> |
| 75 | + ))} |
| 76 | + </Card> |
| 77 | + <SmallGlasButton onPress={() => wallet.initNextRestorePage()}> |
| 78 | + Next |
| 79 | + </SmallGlasButton> |
| 80 | + </MainContent> |
| 81 | + </Background> |
| 82 | +); |
95 | 83 |
|
96 | 84 | RestoreSeedView.propTypes = {
|
97 | 85 | store: PropTypes.object.isRequired,
|
|
0 commit comments