BlueWallet/BlueComponents.js

1104 lines
28 KiB
JavaScript
Raw Normal View History

2018-01-30 23:42:38 +01:00
/** @type {AppStorage} */
2018-03-17 21:39:21 +01:00
import React, { Component } from 'react';
2018-06-25 00:22:46 +02:00
import Ionicons from 'react-native-vector-icons/Ionicons';
2018-07-18 00:43:23 +02:00
import { LinearGradient, Constants } from 'expo';
import { Icon, Button, FormLabel, FormInput, Text, Header, List, ListItem } from 'react-native-elements';
import { TouchableOpacity, ActivityIndicator, View, StyleSheet, Dimensions, Image, SafeAreaView } from 'react-native';
2018-07-14 21:53:43 +02:00
import { WatchOnlyWallet, LegacyWallet } from './class';
2018-06-25 00:22:46 +02:00
import Carousel from 'react-native-snap-carousel';
import { HDLegacyP2PKHWallet } from './class/hd-legacy-p2pkh-wallet';
import { HDLegacyBreadwalletWallet } from './class/hd-legacy-breadwallet-wallet';
import { HDSegwitP2SHWallet } from './class/hd-segwit-p2sh-wallet';
2018-08-19 16:54:15 +02:00
import { LightningCustodianWallet } from './class/lightning-custodian-wallet';
2018-06-25 00:22:46 +02:00
let loc = require('./loc/');
2018-05-22 19:10:53 +02:00
/** @type {AppStorage} */
2018-03-17 21:39:21 +01:00
let BlueApp = require('./BlueApp');
2018-05-12 22:27:34 +02:00
const { height, width } = Dimensions.get('window');
const aspectRatio = height / width;
let isIpad;
if (aspectRatio > 1.6) {
isIpad = false;
} else {
isIpad = true;
}
2018-01-30 23:42:38 +01:00
export class BlueButton extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-07-14 20:54:27 +02:00
// eslint-disable-next-line
this.props.buttonStyle = this.props.buttonStyle || {};
2018-01-30 23:42:38 +01:00
return (
<Button
2018-06-30 15:36:13 +02:00
activeOpacity={0.1}
delayPressIn={0}
2018-01-30 23:42:38 +01:00
{...this.props}
2018-03-17 21:39:21 +01:00
style={{
marginTop: 20,
borderWidth: 0.7,
2018-06-30 15:36:13 +02:00
borderColor: 'transparent',
2018-03-17 21:39:21 +01:00
}}
2018-07-14 20:54:27 +02:00
buttonStyle={Object.assign(
{
backgroundColor: '#ccddf9',
height: 45,
borderWidth: 0,
borderRadius: 25,
},
this.props.buttonStyle,
)}
color="#0c2550"
/>
);
}
}
export class BitcoinButton extends Component {
render() {
return (
<TouchableOpacity
onPress={() => {
// eslint-disable-next-line
if (this.props.onPress) this.props.onPress();
}}
>
<View
style={{
// eslint-disable-next-line
borderColor: (this.props.active && BlueApp.settings.foregroundColor) || '#d2d2d2',
borderWidth: 0.5,
borderRadius: 5,
backgroundColor: '#f5f5f5',
// eslint-disable-next-line
width: this.props.style.width,
// eslint-disable-next-line
height: this.props.style.height,
}}
>
<View style={{ paddingTop: 30 }}>
<Icon name="btc" size={32} type="font-awesome" color={(this.props.active && BlueApp.settings.foregroundColor) || '#d2d2d2'} />
<Text style={{ textAlign: 'center', color: (this.props.active && BlueApp.settings.foregroundColor) || '#d2d2d2' }}>
2018-07-28 21:14:08 +02:00
{loc.wallets.add.bitcoin}
2018-07-14 20:54:27 +02:00
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export class LightningButton extends Component {
render() {
return (
<TouchableOpacity
onPress={() => {
// eslint-disable-next-line
if (this.props.onPress) this.props.onPress();
}}
>
<View
style={{
// eslint-disable-next-line
borderColor: (this.props.active && BlueApp.settings.foregroundColor) || '#d2d2d2',
borderWidth: 0.5,
borderRadius: 5,
backgroundColor: '#f5f5f5',
// eslint-disable-next-line
width: this.props.style.width,
// eslint-disable-next-line
height: this.props.style.height,
}}
>
<View style={{ paddingTop: 30 }}>
<Icon name="bolt" size={32} type="font-awesome" color={(this.props.active && BlueApp.settings.foregroundColor) || '#d2d2d2'} />
<Text style={{ textAlign: 'center', color: (this.props.active && BlueApp.settings.foregroundColor) || '#d2d2d2' }}>
2018-07-28 21:14:08 +02:00
{loc.wallets.add.lightning}
2018-07-14 20:54:27 +02:00
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export class BlueButtonLink extends Component {
render() {
// eslint-disable-next-line
this.props.buttonStyle = this.props.buttonStyle || {};
return (
<Button
activeOpacity={0.1}
delayPressIn={0}
{...this.props}
style={{
marginTop: 20,
borderWidth: 0.7,
borderColor: 'transparent',
}}
buttonStyle={{
2018-09-18 08:48:53 +02:00
height: 45,
width: width / 1.5,
2018-07-14 20:54:27 +02:00
}}
backgroundColor="transparent"
2018-06-30 15:36:13 +02:00
color="#0c2550"
2018-01-30 23:42:38 +01:00
/>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
export class SafeBlueArea extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
<SafeAreaView
{...this.props}
2018-03-17 21:39:21 +01:00
forceInset={{ horizontal: 'always' }}
style={{ flex: 1, backgroundColor: BlueApp.settings.brandingColor }}
2018-01-30 23:42:38 +01:00
/>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
export class BlueCard extends Component {
2018-03-17 21:39:21 +01:00
render() {
return <View {...this.props} style={{ padding: 20 }} />;
2018-01-30 23:42:38 +01:00
}
}
export class BlueText extends Component {
2018-03-17 21:39:21 +01:00
render() {
return (
<Text
{...this.props}
style={Object.assign(
{
color: BlueApp.settings.foregroundColor,
},
// eslint-disable-next-line
this.props.style,
)}
/>
);
2018-01-30 23:42:38 +01:00
}
}
2018-07-14 20:54:27 +02:00
export class BlueTextCentered extends Component {
render() {
return <Text {...this.props} style={{ color: BlueApp.settings.foregroundColor, textAlign: 'center' }} />;
}
}
2018-01-30 23:42:38 +01:00
export class BlueListItem extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
<ListItem
{...this.props}
2018-05-06 19:36:48 +02:00
containerStyle={{
2018-06-25 00:22:46 +02:00
backgroundColor: 'transparent',
borderBottomColor: 'transparent',
borderBottomWidth: 0,
2018-05-06 19:36:48 +02:00
}}
2018-06-25 00:22:46 +02:00
titleStyle={{
color: BlueApp.settings.foregroundColor,
fontSize: 16,
fontWeight: '500',
}}
subtitleStyle={{ color: '#9aa0aa' }}
2018-01-30 23:42:38 +01:00
/>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
export class BlueFormLabel extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-07-14 20:54:27 +02:00
return <FormLabel {...this.props} labelStyle={{ color: BlueApp.settings.foregroundColor, fontWeight: '400' }} />;
2018-01-30 23:42:38 +01:00
}
}
export class BlueFormInput extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-05-06 19:14:22 +02:00
return (
<FormInput
{...this.props}
inputStyle={{ color: BlueApp.settings.foregroundColor, maxWidth: width - 105 }}
containerStyle={{
marginTop: 5,
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 0.5,
borderBottomWidth: 0.5,
backgroundColor: '#f5f5f5',
}}
/>
);
}
}
export class BlueFormMultiInput extends Component {
render() {
return (
<FormInput
{...this.props}
multiline
numberOfLines={4}
inputStyle={{
width: width - 40,
color: BlueApp.settings.foregroundColor,
height: 120,
fontSize: (isIpad && 10) || ((is.iphone8() && 12) || 14),
}}
2018-05-22 19:12:16 +02:00
containerStyle={{
2018-07-14 20:54:27 +02:00
marginTop: 5,
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 0.5,
2018-05-22 19:12:16 +02:00
borderBottomWidth: 0.5,
2018-07-14 20:54:27 +02:00
backgroundColor: '#f5f5f5',
2018-05-22 19:12:16 +02:00
}}
2018-05-06 19:14:22 +02:00
/>
);
2018-05-06 19:12:14 +02:00
}
}
export class BlueFormInputAddress extends Component {
render() {
2018-05-06 19:14:22 +02:00
return (
<FormInput
{...this.props}
2018-05-22 19:12:16 +02:00
inputStyle={{
2018-08-19 00:10:12 +02:00
maxWidth: width - 110,
2018-05-22 19:12:16 +02:00
color: BlueApp.settings.foregroundColor,
2018-07-18 00:43:23 +02:00
fontSize: (isIpad && 10) || ((is.iphone8() && 12) || 14),
2018-05-22 19:12:16 +02:00
}}
containerStyle={{
2018-07-18 00:43:23 +02:00
marginTop: 5,
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 0.5,
2018-05-22 19:12:16 +02:00
borderBottomWidth: 0.5,
2018-07-18 00:43:23 +02:00
backgroundColor: '#f5f5f5',
2018-05-22 19:12:16 +02:00
}}
2018-05-06 19:14:22 +02:00
/>
);
2018-01-30 23:42:38 +01:00
}
}
export class BlueHeader extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
<Header
{...this.props}
2018-06-25 00:22:46 +02:00
backgroundColor="transparent"
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
2018-06-28 03:43:28 +02:00
statusBarProps={{ barStyle: 'default' }}
/>
);
}
}
export class BlueHeaderDefaultSub extends Component {
render() {
return (
<SafeAreaView style={{ backgroundColor: '#FFFFFF' }}>
<Header
{...this.props}
backgroundColor="#FFFFFF"
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
statusBarProps={{ barStyle: 'default' }}
leftComponent={
<Text
style={{
fontWeight: 'bold',
fontSize: 34,
color: BlueApp.settings.foregroundColor,
}}
>
{
// eslint-disable-next-line
this.props.leftText
}
</Text>
}
rightComponent={
<TouchableOpacity
onPress={() => {
// eslint-disable-next-line
if (this.props.onClose) this.props.onClose();
}}
>
<View style={stylesBlueIcon.box}>
<View style={stylesBlueIcon.ballTransparrent}>
<Icon name="times" size={16} type="font-awesome" color={BlueApp.settings.foregroundColor} />
</View>
2018-06-28 03:43:28 +02:00
</View>
</TouchableOpacity>
}
/>
</SafeAreaView>
2018-06-28 03:43:28 +02:00
);
}
}
export class BlueHeaderDefaultMain extends Component {
render() {
return (
<SafeAreaView style={{ backgroundColor: '#FFFFFF' }}>
<View style={{ height: 120 }}>
2018-06-28 03:43:28 +02:00
<TouchableOpacity
onPress={() => {
// eslint-disable-next-line
if (this.props.onClose) this.props.onClose();
}}
>
<View style={stylesBlueIcon.box}>
<View style={stylesBlueIcon.ballTransparrent}>
2018-07-07 15:04:32 +02:00
<Icon name="kebab-horizontal" size={22} type="octicon" color={BlueApp.settings.foregroundColor} />
2018-06-28 03:43:28 +02:00
</View>
</View>
</TouchableOpacity>
<Header
{...this.props}
backgroundColor="#FFFFFF"
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
statusBarProps={{ barStyle: 'default' }}
leftComponent={
<Text
style={{
fontWeight: 'bold',
fontSize: 34,
color: BlueApp.settings.foregroundColor,
}}
>
{
// eslint-disable-next-line
this.props.leftText
}
</Text>
}
rightComponent={
<TouchableOpacity
onPress={this.props.onNewWalletPress}
style={{
height: 48,
alignSelf: 'flex-end',
}}
>
<BluePlusIcon />
</TouchableOpacity>
}
/>
</View>
</SafeAreaView>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
export class BlueSpacing extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-07-07 15:04:32 +02:00
return <View {...this.props} style={{ height: 60, backgroundColor: BlueApp.settings.brandingColor }} />;
2018-01-30 23:42:38 +01:00
}
}
2018-06-29 00:17:14 +02:00
2018-05-12 22:27:34 +02:00
export class BlueSpacing40 extends Component {
render() {
2018-07-07 15:04:32 +02:00
return <View {...this.props} style={{ height: 50, backgroundColor: BlueApp.settings.brandingColor }} />;
2018-05-12 22:27:34 +02:00
}
}
2018-01-30 23:42:38 +01:00
2018-06-29 00:17:14 +02:00
export class BlueSpacingVariable extends Component {
render() {
if (isIpad) {
return <BlueSpacing40 {...this.props} />;
} else {
return <BlueSpacing {...this.props} />;
}
}
}
export class is {
static ipad() {
return isIpad;
}
2018-07-18 00:43:23 +02:00
static iphone8() {
return Constants.platform.ios.platform === 'iPhone10,4';
}
2018-06-29 00:17:14 +02:00
}
2018-01-30 23:42:38 +01:00
export class BlueSpacing20 extends Component {
2018-06-25 00:22:46 +02:00
render() {
return <View {...this.props} style={{ height: 20, opacity: 0 }} />;
}
}
export class BlueList extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
2018-06-25 00:22:46 +02:00
<List
2018-01-30 23:42:38 +01:00
{...this.props}
2018-06-25 00:22:46 +02:00
containerStyle={{
backgroundColor: BlueApp.settings.brandingColor,
borderTopColor: 'transparent',
borderTopWidth: 0,
flex: 1,
2018-06-25 00:22:46 +02:00
}}
2018-01-30 23:42:38 +01:00
/>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
2018-06-25 00:22:46 +02:00
export class BlueLoading extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-06-25 00:22:46 +02:00
return (
<SafeBlueArea>
<View style={{ flex: 1, paddingTop: 200 }}>
<ActivityIndicator />
</View>
</SafeBlueArea>
);
2018-01-30 23:42:38 +01:00
}
}
2018-06-25 00:22:46 +02:00
const stylesBlueIcon = StyleSheet.create({
container: {
flex: 1,
},
containerRefresh: {
flex: 1,
position: 'absolute',
right: 10,
},
box1: {
position: 'relative',
top: 15,
},
2018-06-28 03:43:28 +02:00
box: {
alignSelf: 'flex-end',
paddingHorizontal: 14,
paddingTop: 8,
2018-06-28 03:43:28 +02:00
},
2018-06-25 00:22:46 +02:00
boxIncomming: {
position: 'relative',
},
ball: {
width: 30,
height: 30,
borderRadius: 15,
backgroundColor: '#ccddf9',
},
ballIncomming: {
width: 30,
height: 30,
borderRadius: 15,
backgroundColor: '#d2f8d6',
transform: [{ rotate: '-45deg' }],
},
ballReceive: {
width: 30,
height: 30,
borderBottomLeftRadius: 15,
backgroundColor: '#d2f8d6',
transform: [{ rotate: '-45deg' }],
},
ballOutgoing: {
width: 30,
height: 30,
borderRadius: 15,
backgroundColor: '#f8d2d2',
transform: [{ rotate: '225deg' }],
},
ballTransparrent: {
width: 30,
height: 30,
borderRadius: 15,
backgroundColor: 'transparent',
},
ballDimmed: {
width: 30,
height: 30,
borderRadius: 15,
backgroundColor: 'gray',
},
});
export class BluePlusIcon extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
2018-06-25 00:22:46 +02:00
<View {...this.props} style={stylesBlueIcon.container}>
<View style={stylesBlueIcon.box1}>
<View style={stylesBlueIcon.ball}>
<Ionicons
{...this.props}
name={'ios-add'}
size={26}
style={{
color: BlueApp.settings.foregroundColor,
backgroundColor: 'transparent',
left: 8,
top: 1,
}}
/>
</View>
</View>
</View>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
2018-06-25 00:22:46 +02:00
export class BlueRefreshIcon extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
2018-06-25 00:22:46 +02:00
<TouchableOpacity {...this.props} style={stylesBlueIcon.containerRefresh}>
<View style={stylesBlueIcon.box1}>
2018-06-28 03:43:28 +02:00
<View style={stylesBlueIcon.ballTransparrent}>
2018-06-25 00:22:46 +02:00
<Ionicons
{...this.props}
name={'ios-refresh'}
2018-06-28 03:43:28 +02:00
size={30}
2018-06-25 00:22:46 +02:00
style={{
color: BlueApp.settings.foregroundColor,
backgroundColor: 'transparent',
left: 8,
top: 2,
}}
/>
</View>
</View>
</TouchableOpacity>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}
2018-06-25 00:22:46 +02:00
export class BlueTransactionIncommingIcon extends Component {
2018-03-17 21:39:21 +01:00
render() {
2018-01-30 23:42:38 +01:00
return (
<View {...this.props}>
2018-06-25 00:22:46 +02:00
<View style={stylesBlueIcon.boxIncomming}>
<View style={stylesBlueIcon.ballIncomming}>
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color="#37c0a1" iconStyle={{ left: 0, top: 8 }} />
2018-06-25 00:22:46 +02:00
</View>
2018-01-30 23:42:38 +01:00
</View>
2018-06-25 00:22:46 +02:00
</View>
);
}
}
export class BlueTransactionPendingIcon extends Component {
render() {
return (
<View {...this.props}>
2018-09-25 23:22:11 +02:00
<View style={stylesBlueIcon.boxIncomming}>
2018-06-25 00:22:46 +02:00
<View style={stylesBlueIcon.ball}>
<Icon
{...this.props}
name="ellipsis-h"
size={16}
type="font-awesome"
color={BlueApp.settings.foregroundColor}
iconStyle={{ left: 0, top: 6 }}
/>
</View>
</View>
</View>
);
}
}
export class BlueTransactionOnchainIcon extends Component {
render() {
return (
<View {...this.props}>
<View style={stylesBlueIcon.boxIncomming}>
<View style={stylesBlueIcon.ballIncomming}>
<Icon
{...this.props}
name="link"
size={16}
type="font-awesome"
color="#37c0a1"
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '-45deg' }] }}
/>
</View>
</View>
</View>
);
}
}
2018-09-05 00:18:24 +02:00
export class BlueTransactionOffchainIcon extends Component {
render() {
return (
<View {...this.props}>
2018-09-05 00:18:24 +02:00
<View style={stylesBlueIcon.boxIncomming}>
<View style={stylesBlueIcon.ballOutgoing}>
<Icon
{...this.props}
name="bolt"
size={16}
type="font-awesome"
color="#d0021b"
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '135deg' }] }}
/>
</View>
</View>
</View>
);
}
}
export class BlueTransactionOffchainIncomingIcon extends Component {
render() {
return (
<View {...this.props}>
2018-09-05 00:18:24 +02:00
<View style={stylesBlueIcon.boxIncomming}>
<View style={stylesBlueIcon.ballIncomming}>
<Icon
{...this.props}
name="bolt"
size={16}
type="font-awesome"
color="#37c0a1"
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '45deg' }] }}
/>
</View>
</View>
</View>
);
}
}
2018-06-25 00:22:46 +02:00
export class BlueTransactionOutgoingIcon extends Component {
render() {
return (
<View {...this.props}>
2018-06-25 00:22:46 +02:00
<View style={stylesBlueIcon.boxIncomming}>
<View style={stylesBlueIcon.ballOutgoing}>
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color="#d0021b" iconStyle={{ left: 0, top: 8 }} />
2018-06-25 00:22:46 +02:00
</View>
</View>
</View>
);
}
}
2018-06-29 00:17:14 +02:00
//
2018-06-25 00:22:46 +02:00
export class BlueReceiveButtonIcon extends Component {
render() {
return (
2018-06-29 00:17:14 +02:00
<TouchableOpacity
{...this.props}
2018-06-29 02:04:55 +02:00
style={{
flex: 1,
position: 'absolute',
bottom: 30,
right: width / 2 + 5,
2018-06-29 02:04:55 +02:00
}}
2018-06-29 00:17:14 +02:00
>
<View>
2018-06-25 00:22:46 +02:00
<View
style={{
flex: 1,
flexDirection: 'row',
width: 100,
height: 40,
position: 'relative',
backgroundColor: '#ccddf9',
borderBottomLeftRadius: 15,
borderTopLeftRadius: 15,
}}
>
<View
style={{
width: 30,
height: 30,
borderBottomLeftRadius: 15,
backgroundColor: 'transparent',
transform: [{ rotate: '-45deg' }],
}}
>
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color="#2f5fb3" iconStyle={{ left: 0, top: 15 }} />
2018-06-25 00:22:46 +02:00
</View>
<Text
style={{
2018-06-30 15:36:13 +02:00
color: '#2f5fb3',
2018-06-29 00:17:14 +02:00
fontSize: (isIpad && 10) || 16,
2018-06-25 00:22:46 +02:00
fontWeight: '500',
left: 5,
top: 12,
backgroundColor: 'transparent',
position: 'relative',
}}
>
{loc.receive.list.header}
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export class BlueSendButtonIcon extends Component {
render() {
return (
2018-06-29 00:17:14 +02:00
<TouchableOpacity
{...this.props}
2018-06-29 02:04:55 +02:00
style={{
flex: 1,
position: 'absolute',
bottom: 30,
left: width / 2 + 5,
2018-06-29 02:04:55 +02:00
}}
2018-06-29 00:17:14 +02:00
>
<View>
2018-06-25 00:22:46 +02:00
<View
style={{
flex: 1,
flexDirection: 'row',
width: 110,
height: 40,
position: 'relative',
backgroundColor: '#ccddf9',
borderBottomRightRadius: 15,
borderTopRightRadius: 15,
}}
>
<View
style={{
width: 30,
height: 30,
left: 5,
borderBottomLeftRadius: 15,
backgroundColor: 'transparent',
transform: [{ rotate: '225deg' }],
}}
>
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color="#2f5fb3" iconStyle={{ left: 0, top: 0 }} />
2018-06-25 00:22:46 +02:00
</View>
<Text
style={{
2018-06-30 15:36:13 +02:00
color: '#2f5fb3',
2018-06-29 00:17:14 +02:00
fontSize: (isIpad && 10) || 16,
2018-06-25 00:22:46 +02:00
fontWeight: '500',
left: 5,
top: 12,
backgroundColor: 'transparent',
position: 'relative',
}}
>
{loc.send.list.header}
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export class ManageFundsBigButton extends Component {
render() {
return (
<TouchableOpacity
{...this.props}
style={{
flex: 1,
position: 'absolute',
bottom: 30,
left: (width - 190) / 2,
}}
>
<View>
<View
style={{
flex: 1,
flexDirection: 'row',
width: 190,
height: 40,
position: 'relative',
backgroundColor: '#ccddf9',
borderBottomRightRadius: 15,
borderBottomLeftRadius: 15,
borderTopRightRadius: 15,
borderTopLeftRadius: 15,
}}
>
<View
style={{
width: 30,
height: 30,
left: 20,
top: 5,
borderBottomLeftRadius: 15,
backgroundColor: 'transparent',
transform: [{ rotate: '90deg' }],
}}
>
<Icon {...this.props} name="link" size={16} type="font-awesome" color="#2f5fb3" iconStyle={{ left: 0, top: 0 }} />
</View>
<Text
style={{
color: '#2f5fb3',
fontSize: (isIpad && 10) || 16,
fontWeight: '500',
left: 25,
top: 12,
backgroundColor: 'transparent',
position: 'relative',
}}
>
manage funds
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
2018-06-25 00:22:46 +02:00
export class BluePlusIconDimmed extends Component {
render() {
return (
<View {...this.props} style={stylesBlueIcon.container}>
<View style={stylesBlueIcon.box1}>
<View style={stylesBlueIcon.ballDimmed}>
<Ionicons
{...this.props}
name={'ios-add'}
size={26}
style={{
color: 'white',
backgroundColor: 'transparent',
left: 8,
top: 1,
}}
/>
</View>
</View>
</View>
);
}
}
export class NewWalletPannel extends Component {
constructor(props) {
super(props);
// WalletsCarousel.handleClick = props.handleClick // because cant access `this` from _renderItem
// eslint-disable-next-line
this.handleClick = props.onPress;
}
render() {
return (
<TouchableOpacity
{...this.props}
style={{ paddingRight: 10, left: -20, paddingTop: 20 }}
onPress={() => {
if (this.handleClick) {
this.handleClick();
}
}}
>
<LinearGradient
colors={['#eef0f4', '#eef0f4']}
style={{
padding: 15,
borderRadius: 10,
height: 145,
justifyContent: 'center',
alignItems: 'center',
}}
>
<BluePlusIconDimmed />
<Text
style={{
backgroundColor: 'transparent',
fontWeight: 'bold',
fontSize: 20,
color: '#9aa0aa',
}}
>
{loc.wallets.list.create_a_wallet}
</Text>
<Text style={{ backgroundColor: 'transparent' }} />
<Text
style={{
backgroundColor: 'transparent',
fontSize: 13,
color: '#9aa0aa',
}}
>
{loc.wallets.list.create_a_wallet1}
</Text>
<Text
style={{
backgroundColor: 'transparent',
fontSize: 13,
color: '#9aa0aa',
}}
>
{loc.wallets.list.create_a_wallet2}
</Text>
</LinearGradient>
</TouchableOpacity>
);
}
}
let sliderWidth = width * 1;
let itemWidth = width * 0.82;
let sliderHeight = 175;
export class WalletsCarousel extends Component {
constructor(props) {
super(props);
// eslint-disable-next-line
WalletsCarousel.handleClick = props.handleClick; // because cant access `this` from _renderItem
// eslint-disable-next-line
this.onSnapToItem = props.onSnapToItem;
}
_renderItem({ item, index }) {
if (!item) {
return (
<NewWalletPannel
onPress={() => {
if (WalletsCarousel.handleClick) {
WalletsCarousel.handleClick(index);
}
}}
/>
);
}
2018-07-14 21:53:43 +02:00
let gradient1 = '#65ceef';
let gradient2 = '#68bbe1';
if (new WatchOnlyWallet().type === item.type) {
gradient1 = '#7d7d7d';
gradient2 = '#4a4a4a';
}
if (new LegacyWallet().type === item.type) {
gradient1 = '#40fad1';
gradient2 = '#15be98';
}
if (new HDLegacyP2PKHWallet().type === item.type) {
gradient1 = '#e36dfa';
gradient2 = '#bd10e0';
}
if (new HDLegacyBreadwalletWallet().type === item.type) {
gradient1 = '#fe6381';
gradient2 = '#f99c42';
}
if (new HDSegwitP2SHWallet().type === item.type) {
gradient1 = '#c65afb';
gradient2 = '#9053fe';
}
2018-08-19 16:54:15 +02:00
if (new LightningCustodianWallet().type === item.type) {
gradient1 = '#f1be07';
gradient2 = '#f79056';
}
2018-06-25 00:22:46 +02:00
return (
<TouchableOpacity
activeOpacity={1}
style={{ paddingRight: 10, left: -20, paddingTop: 20 }}
onPress={() => {
if (WalletsCarousel.handleClick) {
WalletsCarousel.handleClick(index);
}
}}
>
2018-07-14 21:53:43 +02:00
<LinearGradient colors={[gradient1, gradient2]} style={{ padding: 15, borderRadius: 10, height: 145 }}>
2018-06-25 00:22:46 +02:00
<Image
2018-08-19 16:54:15 +02:00
source={(new LightningCustodianWallet().type === item.type && require('./img/lnd-shape.png')) || require('./img/btc-shape.png')}
2018-06-25 00:22:46 +02:00
style={{
width: 99,
height: 94,
position: 'absolute',
bottom: 0,
right: 0,
}}
/>
<Text style={{ backgroundColor: 'transparent' }} />
<Text
style={{
backgroundColor: 'transparent',
fontSize: 19,
color: '#fff',
}}
>
{item.getLabel()}
</Text>
<Text
style={{
backgroundColor: 'transparent',
fontWeight: 'bold',
fontSize: 36,
color: '#fff',
}}
>
2018-07-06 17:42:37 +02:00
{loc.formatBalance(item.getBalance())}
2018-06-25 00:22:46 +02:00
</Text>
<Text style={{ backgroundColor: 'transparent' }} />
<Text
style={{
backgroundColor: 'transparent',
fontSize: 13,
color: '#fff',
}}
>
2018-06-30 14:52:18 +02:00
{loc.wallets.list.latest_transaction}
2018-06-25 00:22:46 +02:00
</Text>
<Text
style={{
backgroundColor: 'transparent',
fontWeight: 'bold',
fontSize: 16,
color: '#fff',
}}
>
{loc.transactionTimeToReadable(item.getLatestTransactionTime())}
</Text>
</LinearGradient>
</TouchableOpacity>
);
}
render() {
return (
<View style={{ height: sliderHeight }}>
<Carousel
{...this.props}
ref={c => {
WalletsCarousel.carousel = c;
}}
renderItem={this._renderItem}
sliderWidth={sliderWidth}
itemWidth={itemWidth}
inactiveSlideScale={1}
inactiveSlideOpacity={0.7}
onSnapToItem={index => {
if (this.onSnapToItem) {
this.onSnapToItem(index);
}
console.log('snapped to card #', index);
}}
/>
</View>
2018-03-17 21:39:21 +01:00
);
2018-01-30 23:42:38 +01:00
}
}