QRScannerAndDerivationTab.tsx 2.19 KB
Newer Older
1
// Copyright 2015-2020 Parity Technologies (UK) Ltd.
Hanwen Cheng's avatar
Hanwen Cheng committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This file is part of Parity.

// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity.  If not, see <http://www.gnu.org/licenses/>.

import React from 'react';
18
import { StyleSheet, Text, View } from 'react-native';
19

20
21
import TouchableItem from './TouchableItem';
import Separator from './Separator';
Hanwen Cheng's avatar
Hanwen Cheng committed
22

23
import QrScannerTab from 'components/QrScannerTab';
24
25
26
import colors from 'styles/colors';
import fontStyles from 'styles/fontStyles';
import { ButtonListener } from 'types/props';
Hanwen Cheng's avatar
Hanwen Cheng committed
27

28
export default class QRScannerAndDerivationTab extends React.PureComponent<{
29
30
	onPress: ButtonListener;
	title: string;
31
	derivationTestID?: string;
32
33
}> {
	render(): React.ReactElement {
34
		const { onPress, title, derivationTestID } = this.props;
Hanwen Cheng's avatar
Hanwen Cheng committed
35
		return (
36
			<View style={styles.body}>
37
38
39
40
41
				<Separator
					shadow={true}
					style={{ backgroundColor: 'transparent', marginVertical: 0 }}
					shadowStyle={{ height: 16, marginTop: -16 }}
				/>
42
43
44
45
46
47
48
49
50
51
52
53
54
55
				<View style={styles.tab}>
					<QrScannerTab />
				</View>
				<View style={styles.tab}>
					<TouchableItem
						onPress={onPress}
						style={styles.derivationButton}
						testID={derivationTestID}
					>
						<Text style={styles.icon}>//</Text>
						<Text style={styles.textLabel}>{title}</Text>
					</TouchableItem>
				</View>
			</View>
Hanwen Cheng's avatar
Hanwen Cheng committed
56
57
58
59
60
		);
	}
}

const styles = StyleSheet.create({
61
62
	body: { flexDirection: 'row' },
	derivationButton: {
Hanwen Cheng's avatar
Hanwen Cheng committed
63
		alignItems: 'center',
64
65
		backgroundColor: colors.background.os,
		height: 72
Hanwen Cheng's avatar
Hanwen Cheng committed
66
	},
67
68
69
70
71
	icon: {
		...fontStyles.i_large,
		color: colors.signal.main,
		marginTop: 8
	},
72
73
74
75
	tab: {
		flex: 1,
		flexGrow: 1
	},
76
77
78
79
	textLabel: {
		...fontStyles.a_text,
		color: colors.text.faded,
		marginTop: 4
Hanwen Cheng's avatar
Hanwen Cheng committed
80
81
	}
});