You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1104 lines
28 KiB

7 years ago
/** @type {AppStorage} */
7 years ago
import React, { Component } from 'react';
6 years ago
import Ionicons from 'react-native-vector-icons/Ionicons';
import { Icon, Button, FormLabel, FormInput, Text, Header, List, ListItem } from 'react-native-elements';
import {
TouchableOpacity,
TouchableWithoutFeedback,
Animated,
ActivityIndicator,
View,
StyleSheet,
Dimensions,
Image,
SafeAreaView,
Clipboard,
Platform,
} from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import { WatchOnlyWallet, LegacyWallet } from './class';
6 years ago
import Carousel from 'react-native-snap-carousel';
import DeviceInfo from 'react-native-device-info';
import { HDLegacyP2PKHWallet } from './class/hd-legacy-p2pkh-wallet';
import { HDLegacyBreadwalletWallet } from './class/hd-legacy-breadwallet-wallet';
import { HDSegwitP2SHWallet } from './class/hd-segwit-p2sh-wallet';
import { LightningCustodianWallet } from './class/lightning-custodian-wallet';
6 years ago
let loc = require('./loc/');
7 years ago
/** @type {AppStorage} */
7 years ago
let BlueApp = require('./BlueApp');
const { height, width } = Dimensions.get('window');
const aspectRatio = height / width;
let isIpad;
if (aspectRatio > 1.6) {
isIpad = false;
} else {
isIpad = true;
}
7 years ago
export class BlueButton extends Component {
7 years ago
render() {
// eslint-disable-next-line
this.props.buttonStyle = this.props.buttonStyle || {};
7 years ago
return (
<Button
activeOpacity={0.1}
delayPressIn={0}
7 years ago
{...this.props}
7 years ago
style={{
borderWidth: 0.7,
borderColor: 'transparent',
7 years ago
}}
buttonStyle={Object.assign(
{
backgroundColor: '#ccddf9',
minHeight: 45,
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' }}>
6 years ago
{loc.wallets.add.bitcoin}
</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' }}>
6 years ago
{loc.wallets.add.lightning}
</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={{
6 years ago
height: 45,
width: width / 1.5,
}}
backgroundColor="transparent"
color="#0c2550"
7 years ago
/>
7 years ago
);
7 years ago
}
}
export const BlueNavigationStyle = (navigation, withNavigationCloseButton = false, customCloseButtonFunction = undefined) => ({
headerStyle: {
backgroundColor: '#FFFFFF',
borderBottomWidth: 0,
elevation: 0,
},
headerTitleStyle: {
fontWeight: '600',
color: '#0c2550',
},
headerTintColor: '#0c2550',
headerRight: withNavigationCloseButton ? (
<TouchableOpacity
style={{ width: 40, height: 40, padding: 14 }}
onPress={customCloseButtonFunction === undefined ? () => navigation.goBack(null) : customCloseButtonFunction}
>
<Image style={{ alignSelf: 'center' }} source={require('./img/close.png')} />
</TouchableOpacity>
) : null,
headerBackTitle: null,
});
6 years ago
export const BlueCopyToClipboardButton = ({ stringToCopy }) => {
return (
<TouchableOpacity {...this.props} onPress={() => Clipboard.setString(stringToCopy)}>
<Text style={{ fontSize: 13, fontWeight: '400', color: '#68bbe1' }}>{loc.transactions.details.copy}</Text>
</TouchableOpacity>
);
};
7 years ago
export class SafeBlueArea extends Component {
7 years ago
render() {
7 years ago
return (
<SafeAreaView
{...this.props}
7 years ago
forceInset={{ horizontal: 'always' }}
style={{ flex: 1, backgroundColor: BlueApp.settings.brandingColor }}
7 years ago
/>
7 years ago
);
7 years ago
}
}
export class BlueCard extends Component {
7 years ago
render() {
return <View {...this.props} style={{ padding: 20 }} />;
7 years ago
}
}
export class BlueText extends Component {
7 years ago
render() {
return (
<Text
style={Object.assign(
{
color: BlueApp.settings.foregroundColor,
},
// eslint-disable-next-line
this.props.style,
)}
{...this.props}
/>
);
7 years ago
}
}
export class BlueTextCentered extends Component {
render() {
return <Text {...this.props} style={{ color: BlueApp.settings.foregroundColor, textAlign: 'center' }} />;
}
}
7 years ago
export class BlueListItem extends Component {
7 years ago
render() {
7 years ago
return (
<ListItem
bottomDivider
7 years ago
containerStyle={{
6 years ago
backgroundColor: 'transparent',
borderBottomStartRadius: 20,
borderBottomEndRadius: 20,
borderBottomColor: '#ededed',
7 years ago
}}
6 years ago
titleStyle={{
color: BlueApp.settings.foregroundColor,
fontSize: 16,
fontWeight: '500',
}}
subtitleStyle={{ color: '#9aa0aa' }}
subtitleNumberOfLines={1}
{...this.props}
7 years ago
/>
7 years ago
);
7 years ago
}
}
export class BlueFormLabel extends Component {
7 years ago
render() {
return <FormLabel {...this.props} labelStyle={{ color: BlueApp.settings.foregroundColor, fontWeight: '400' }} />;
7 years ago
}
}
export class BlueFormInput extends Component {
7 years ago
render() {
7 years ago
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
underlineColorAndroid="transparent"
numberOfLines={4}
inputStyle={{
width: width - 40,
color: BlueApp.settings.foregroundColor,
height: 120,
// fontSize: (isIpad && 10) || ((is.iphone8() && 12) || 14),
}}
7 years ago
containerStyle={{
marginTop: 5,
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 0.5,
7 years ago
borderBottomWidth: 0.5,
backgroundColor: '#f5f5f5',
7 years ago
}}
7 years ago
/>
);
}
}
export class BlueFormInputAddress extends Component {
render() {
7 years ago
return (
<FormInput
{...this.props}
7 years ago
inputStyle={{
maxWidth: width - 110,
7 years ago
color: BlueApp.settings.foregroundColor,
fontSize: (isIpad && 10) || ((is.iphone8() && 12) || 14),
7 years ago
}}
containerStyle={{
marginTop: 5,
borderColor: '#d2d2d2',
borderBottomColor: '#d2d2d2',
borderWidth: 0.5,
7 years ago
borderBottomWidth: 0.5,
backgroundColor: '#f5f5f5',
7 years ago
}}
7 years ago
/>
);
7 years ago
}
}
export class BlueHeader extends Component {
7 years ago
render() {
7 years ago
return (
<Header
{...this.props}
6 years ago
backgroundColor="transparent"
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
6 years ago
statusBarProps={{ barStyle: 'default' }}
/>
);
}
}
export class BlueHeaderDefaultSub extends Component {
render() {
return (
<SafeAreaView style={{ backgroundColor: '#FFFFFF' }}>
<Header
backgroundColor="#FFFFFF"
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
statusBarProps={{ barStyle: 'default' }}
leftComponent={
<Text
adjustsFontSizeToFit
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}>
<Image source={require('./img/close.png')} />
</View>
6 years ago
</View>
</TouchableOpacity>
}
{...this.props}
/>
</SafeAreaView>
6 years ago
);
}
}
export class BlueHeaderDefaultMain extends Component {
render() {
return (
<SafeAreaView style={{ backgroundColor: '#FFFFFF' }}>
<Header
{...this.props}
backgroundColor="#FFFFFF"
outerContainerStyles={{
borderBottomColor: 'transparent',
borderBottomWidth: 0,
}}
statusBarProps={{ barStyle: 'default' }}
leftComponent={
<Text
numberOfLines={0}
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>
}
/>
</SafeAreaView>
7 years ago
);
7 years ago
}
}
export class BlueSpacing extends Component {
7 years ago
render() {
return <View {...this.props} style={{ height: 60, backgroundColor: BlueApp.settings.brandingColor }} />;
7 years ago
}
}
6 years ago
export class BlueSpacing40 extends Component {
render() {
return <View {...this.props} style={{ height: 50, backgroundColor: BlueApp.settings.brandingColor }} />;
}
}
7 years ago
6 years ago
export class BlueSpacingVariable extends Component {
render() {
if (isIpad) {
return <BlueSpacing40 {...this.props} />;
} else {
return <BlueSpacing {...this.props} />;
}
}
}
export class is {
static ipad() {
return isIpad;
}
static iphone8() {
if (Platform.OS !== 'ios') {
return false;
}
return DeviceInfo.getDeviceId() === 'iPhone10,4';
}
6 years ago
}
7 years ago
export class BlueSpacing20 extends Component {
6 years ago
render() {
return <View {...this.props} style={{ height: 20, opacity: 0 }} />;
}
}
export class BlueList extends Component {
7 years ago
render() {
7 years ago
return (
6 years ago
<List
7 years ago
{...this.props}
6 years ago
containerStyle={{
backgroundColor: BlueApp.settings.brandingColor,
borderTopColor: 'transparent',
borderTopWidth: 0,
flex: 1,
6 years ago
}}
7 years ago
/>
7 years ago
);
7 years ago
}
}
6 years ago
export class BlueLoading extends Component {
7 years ago
render() {
6 years ago
return (
<SafeBlueArea>
<View style={{ flex: 1, paddingTop: 200 }}>
<ActivityIndicator />
</View>
</SafeBlueArea>
);
7 years ago
}
}
6 years ago
const stylesBlueIcon = StyleSheet.create({
container: {
flex: 1,
},
box1: {
position: 'relative',
top: 15,
},
6 years ago
box: {
alignSelf: 'flex-end',
paddingHorizontal: 14,
paddingTop: 8,
6 years ago
},
6 years ago
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 {
7 years ago
render() {
7 years ago
return (
6 years ago
<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>
7 years ago
);
7 years ago
}
}
6 years ago
export class BlueTransactionIncommingIcon extends Component {
7 years ago
render() {
7 years ago
return (
<View {...this.props}>
6 years ago
<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 }} />
6 years ago
</View>
7 years ago
</View>
6 years ago
</View>
);
}
}
export class BlueTransactionPendingIcon extends Component {
render() {
return (
<View {...this.props}>
<View style={stylesBlueIcon.boxIncomming}>
6 years ago
<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>
);
}
}
export class BlueTransactionOffchainIcon extends Component {
render() {
return (
<View {...this.props}>
<View style={stylesBlueIcon.boxIncomming}>
<View style={stylesBlueIcon.ballOutgoing}>
<Icon
{...this.props}
name="bolt"
size={16}
type="font-awesome"
color="#d0021b"
6 years ago
iconStyle={{ left: 0, top: 7, transform: [{ rotate: '155deg' }] }}
/>
</View>
</View>
</View>
);
}
}
export class BlueTransactionOffchainIncomingIcon extends Component {
render() {
return (
<View {...this.props}>
<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>
);
}
}
6 years ago
export class BlueTransactionOutgoingIcon extends Component {
render() {
return (
<View {...this.props}>
6 years ago
<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 }} />
6 years ago
</View>
</View>
</View>
);
}
}
6 years ago
//
6 years ago
export class BlueReceiveButtonIcon extends Component {
render() {
return (
<TouchableOpacity {...this.props}>
6 years ago
<View>
6 years ago
<View
style={{
flex: 1,
flexDirection: 'row',
minWidth: 110,
minHeight: 40,
6 years ago
position: 'relative',
backgroundColor: '#ccddf9',
alignItems: 'center',
6 years ago
}}
>
<View
style={{
minWidth: 30,
minHeight: 30,
6 years ago
backgroundColor: 'transparent',
transform: [{ rotate: '-45deg' }],
alignItems: 'center',
6 years ago
}}
>
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color="#2f5fb3" iconStyle={{ left: 5, top: 12 }} />
6 years ago
</View>
<Text
style={{
color: '#2f5fb3',
6 years ago
fontSize: (isIpad && 10) || 16,
6 years ago
fontWeight: '500',
left: 5,
backgroundColor: 'transparent',
}}
>
{loc.receive.header.toLowerCase()}
6 years ago
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export class BlueSendButtonIcon extends Component {
render() {
return (
<TouchableOpacity {...this.props}>
6 years ago
<View>
6 years ago
<View
style={{
flex: 1,
flexDirection: 'row',
width: 110,
height: 40,
backgroundColor: '#ccddf9',
alignItems: 'center',
paddingLeft: 15,
6 years ago
}}
>
<View
style={{
minWidth: 30,
minHeight: 30,
6 years ago
left: 5,
backgroundColor: 'transparent',
transform: [{ rotate: '225deg' }],
}}
>
<Icon {...this.props} name="arrow-down" size={16} type="font-awesome" color="#2f5fb3" iconStyle={{ left: 2, top: 6 }} />
6 years ago
</View>
<Text
style={{
color: '#2f5fb3',
6 years ago
fontSize: (isIpad && 10) || 16,
6 years ago
fontWeight: '500',
backgroundColor: 'transparent',
}}
>
{loc.send.header.toLowerCase()}
6 years ago
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
export class ManageFundsBigButton extends Component {
render() {
return (
<TouchableOpacity {...this.props}>
<View>
<View
style={{
flex: 1,
flexDirection: 'row',
minWidth: 160,
minHeight: 40,
backgroundColor: '#ccddf9',
alignItems: 'center',
}}
>
<View
style={{
backgroundColor: 'transparent',
transform: [{ rotate: '90deg' }],
marginHorizontal: 10,
}}
>
<Icon {...this.props} name="link" size={16} type="font-awesome" color="#2f5fb3" />
</View>
<Text
style={{
color: '#2f5fb3',
fontSize: (isIpad && 10) || 16,
fontWeight: '500',
backgroundColor: 'transparent',
}}
>
{loc.lnd.title}
</Text>
</View>
</View>
</TouchableOpacity>
);
}
}
6 years ago
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 NewWalletPanel extends Component {
6 years ago
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}
onPress={() => {
if (this.handleClick) {
this.handleClick();
}
}}
style={{ marginVertical: 17 }}
6 years ago
>
<LinearGradient
colors={['#eef0f4', '#eef0f4']}
style={{
padding: 15,
borderRadius: 10,
minHeight: 164,
6 years ago
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>
);
}
}
const sliderWidth = width * 1;
const itemWidth = width * 0.82;
const sliderHeight = 190;
6 years ago
export class WalletsCarousel extends Component {
constructor(props) {
super(props);
// eslint-disable-next-line
WalletsCarousel.handleClick = props.handleClick; // because cant access `this` from _renderItem
WalletsCarousel.handleLongPress = props.handleLongPress;
6 years ago
// eslint-disable-next-line
this.onSnapToItem = props.onSnapToItem;
}
_renderItem({ item, index }) {
let scaleValue = new Animated.Value(1.0);
this.onPressedIn = () => {
6 years ago
Animated.spring(scaleValue, { toValue: 0.9, duration: 100, useNativeDriver: Platform.OS === 'android' }).start();
};
this.onPressedOut = () => {
Animated.spring(scaleValue, { toValue: 1.0, duration: 100, useNativeDriver: Platform.OS === 'android' }).start();
};
6 years ago
if (!item) {
return (
<NewWalletPanel
6 years ago
onPress={() => {
if (WalletsCarousel.handleClick) {
WalletsCarousel.handleClick(index);
}
}}
/>
);
}
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';
}
if (new LightningCustodianWallet().type === item.type) {
gradient1 = '#f1be07';
gradient2 = '#f79056';
}
6 years ago
return (
<Animated.View
style={{ paddingRight: 10, marginVertical: 17, transform: [{ scale: scaleValue }] }}
shadowOpacity={40 / 100}
shadowOffset={{ width: 0, height: 0 }}
shadowRadius={5}
>
<TouchableWithoutFeedback
onPressIn={this.onPressedIn}
onPressOut={this.onPressedOut}
onLongPress={WalletsCarousel.handleLongPress}
onPress={() => {
if (WalletsCarousel.handleClick) {
WalletsCarousel.handleClick(index, [gradient1, gradient2]);
}
}}
>
<LinearGradient
shadowColor="#000000"
colors={[gradient1, gradient2]}
style={{
padding: 15,
borderRadius: 10,
minHeight: 164,
elevation: 5,
}}
6 years ago
>
<Image
source={
(new LightningCustodianWallet().type === item.type && require('./img/lnd-shape.png')) || require('./img/btc-shape.png')
}
style={{
width: 99,
height: 94,
position: 'absolute',
bottom: 0,
right: 0,
}}
/>
<Text style={{ backgroundColor: 'transparent' }} />
<Text
numberOfLines={1}
style={{
backgroundColor: 'transparent',
fontSize: 19,
color: '#fff',
}}
>
{item.getLabel()}
</Text>
<Text
numberOfLines={1}
adjustsFontSizeToFit
style={{
backgroundColor: 'transparent',
fontWeight: 'bold',
fontSize: 36,
color: '#fff',
}}
>
{loc.formatBalance(item.getBalance())}
</Text>
<Text style={{ backgroundColor: 'transparent' }} />
<Text
numberOfLines={1}
style={{
backgroundColor: 'transparent',
fontSize: 13,
color: '#fff',
}}
>
{loc.wallets.list.latest_transaction}
</Text>
<Text
numberOfLines={1}
style={{
backgroundColor: 'transparent',
fontWeight: 'bold',
fontSize: 16,
color: '#fff',
}}
>
{loc.transactionTimeToReadable(item.getLatestTransactionTime())}
</Text>
</LinearGradient>
</TouchableWithoutFeedback>
</Animated.View>
6 years ago
);
}
render() {
return (
<Carousel
{...this.props}
ref={c => {
WalletsCarousel.carousel = c;
}}
renderItem={this._renderItem}
sliderWidth={sliderWidth}
sliderHeight={sliderHeight}
itemWidth={itemWidth}
inactiveSlideScale={1}
inactiveSlideOpacity={0.7}
contentContainerCustomStyle={{ left: -20 }}
onSnapToItem={index => {
if (this.onSnapToItem) {
this.onSnapToItem(index);
}
console.log('snapped to card #', index);
}}
/>
7 years ago
);
7 years ago
}
}