mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
REF: recieve/details screen move styles out of render func
This commit is contained in:
parent
c8bd4d3423
commit
47acf28a96
@ -12,10 +12,10 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import LottieView from 'lottie-react-native';
|
import LottieView from 'lottie-react-native';
|
||||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
|
||||||
import { useNavigation, useRoute, useTheme, useFocusEffect } from '@react-navigation/native';
|
import { useNavigation, useRoute, useTheme, useFocusEffect } from '@react-navigation/native';
|
||||||
import Share from 'react-native-share';
|
import Share from 'react-native-share';
|
||||||
|
|
||||||
|
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||||
import {
|
import {
|
||||||
BlueLoading,
|
BlueLoading,
|
||||||
BlueCopyTextToClipboard,
|
BlueCopyTextToClipboard,
|
||||||
@ -65,79 +65,31 @@ const ReceiveDetails = () => {
|
|||||||
const stylesHook = StyleSheet.create({
|
const stylesHook = StyleSheet.create({
|
||||||
modalContent: {
|
modalContent: {
|
||||||
backgroundColor: colors.modal,
|
backgroundColor: colors.modal,
|
||||||
padding: 22,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
borderTopLeftRadius: 16,
|
|
||||||
borderTopRightRadius: 16,
|
|
||||||
borderTopColor: colors.foregroundColor,
|
borderTopColor: colors.foregroundColor,
|
||||||
borderWidth: colors.borderWidth,
|
borderWidth: colors.borderWidth,
|
||||||
minHeight: 350,
|
|
||||||
height: 350,
|
|
||||||
},
|
},
|
||||||
customAmount: {
|
customAmount: {
|
||||||
flexDirection: 'row',
|
|
||||||
borderColor: colors.formBorder,
|
borderColor: colors.formBorder,
|
||||||
borderBottomColor: colors.formBorder,
|
borderBottomColor: colors.formBorder,
|
||||||
borderWidth: 1.0,
|
|
||||||
borderBottomWidth: 0.5,
|
|
||||||
backgroundColor: colors.inputBackgroundColor,
|
backgroundColor: colors.inputBackgroundColor,
|
||||||
minHeight: 44,
|
|
||||||
height: 44,
|
|
||||||
marginHorizontal: 20,
|
|
||||||
alignItems: 'center',
|
|
||||||
marginVertical: 8,
|
|
||||||
borderRadius: 4,
|
|
||||||
},
|
},
|
||||||
customAmountText: {
|
customAmountText: {
|
||||||
flex: 1,
|
|
||||||
marginHorizontal: 8,
|
|
||||||
color: colors.foregroundColor,
|
color: colors.foregroundColor,
|
||||||
minHeight: 33,
|
|
||||||
},
|
},
|
||||||
root: {
|
root: {
|
||||||
flexGrow: 1,
|
|
||||||
backgroundColor: colors.elevated,
|
backgroundColor: colors.elevated,
|
||||||
justifyContent: 'space-between',
|
|
||||||
},
|
},
|
||||||
rootBackgroundColor: {
|
rootBackgroundColor: {
|
||||||
backgroundColor: colors.elevated,
|
backgroundColor: colors.elevated,
|
||||||
},
|
},
|
||||||
scrollBody: {
|
|
||||||
marginTop: 32,
|
|
||||||
flexGrow: 1,
|
|
||||||
alignItems: 'center',
|
|
||||||
paddingHorizontal: 16,
|
|
||||||
},
|
|
||||||
share: {
|
|
||||||
justifyContent: 'flex-end',
|
|
||||||
paddingVertical: 16,
|
|
||||||
alignItems: 'center',
|
|
||||||
marginBottom: 8,
|
|
||||||
},
|
|
||||||
link: {
|
|
||||||
marginVertical: 16,
|
|
||||||
paddingHorizontal: 32,
|
|
||||||
},
|
|
||||||
amount: {
|
amount: {
|
||||||
color: colors.foregroundColor,
|
color: colors.foregroundColor,
|
||||||
fontWeight: '600',
|
|
||||||
fontSize: 36,
|
|
||||||
textAlign: 'center',
|
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
color: colors.foregroundColor,
|
color: colors.foregroundColor,
|
||||||
fontWeight: '600',
|
|
||||||
textAlign: 'center',
|
|
||||||
paddingBottom: 24,
|
|
||||||
},
|
},
|
||||||
modalButton: {
|
modalButton: {
|
||||||
backgroundColor: colors.modalButton,
|
backgroundColor: colors.modalButton,
|
||||||
paddingVertical: 14,
|
|
||||||
paddingHorizontal: 70,
|
|
||||||
maxWidth: '80%',
|
|
||||||
borderRadius: 50,
|
|
||||||
fontWeight: '700',
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -242,16 +194,16 @@ const ReceiveDetails = () => {
|
|||||||
const renderConfirmedBalance = () => {
|
const renderConfirmedBalance = () => {
|
||||||
return (
|
return (
|
||||||
<ScrollView style={stylesHook.rootBackgroundColors} centerContent keyboardShouldPersistTaps="always">
|
<ScrollView style={stylesHook.rootBackgroundColors} centerContent keyboardShouldPersistTaps="always">
|
||||||
<View style={stylesHook.scrollBody}>
|
<View style={styles.scrollBody}>
|
||||||
{isCustom && (
|
{isCustom && (
|
||||||
<>
|
<>
|
||||||
<BlueText style={stylesHook.label} numberOfLines={1}>
|
<BlueText style={[styles.label, stylesHook.label]} numberOfLines={1}>
|
||||||
{customLabel}
|
{customLabel}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<LottieView style={styles.icon} source={require('../../img/bluenice.json')} autoPlay loop={false} />
|
<LottieView style={styles.icon} source={require('../../img/bluenice.json')} autoPlay loop={false} />
|
||||||
<BlueText style={stylesHook.label} numberOfLines={1}>
|
<BlueText style={[styles.label, stylesHook.label]} numberOfLines={1}>
|
||||||
{displayBalance}
|
{displayBalance}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
</View>
|
</View>
|
||||||
@ -262,20 +214,20 @@ const ReceiveDetails = () => {
|
|||||||
const renderPendingBalance = () => {
|
const renderPendingBalance = () => {
|
||||||
return (
|
return (
|
||||||
<ScrollView contentContainerStyle={stylesHook.rootBackgroundColor} centerContent keyboardShouldPersistTaps="always">
|
<ScrollView contentContainerStyle={stylesHook.rootBackgroundColor} centerContent keyboardShouldPersistTaps="always">
|
||||||
<View style={stylesHook.scrollBody}>
|
<View style={styles.scrollBody}>
|
||||||
{isCustom && (
|
{isCustom && (
|
||||||
<>
|
<>
|
||||||
<BlueText style={stylesHook.label} numberOfLines={1}>
|
<BlueText style={[styles.label, stylesHook.label]} numberOfLines={1}>
|
||||||
{customLabel}
|
{customLabel}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<TransactionPendingIconBig />
|
<TransactionPendingIconBig />
|
||||||
<BlueSpacing40 />
|
<BlueSpacing40 />
|
||||||
<BlueText style={stylesHook.label} numberOfLines={1}>
|
<BlueText style={[styles.label, stylesHook.label]} numberOfLines={1}>
|
||||||
{displayBalance}
|
{displayBalance}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
<BlueText style={stylesHook.label} numberOfLines={1}>
|
<BlueText style={[styles.label, stylesHook.label]} numberOfLines={1}>
|
||||||
{eta}
|
{eta}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
</View>
|
</View>
|
||||||
@ -301,17 +253,17 @@ const ReceiveDetails = () => {
|
|||||||
|
|
||||||
const renderReceiveDetails = () => {
|
const renderReceiveDetails = () => {
|
||||||
return (
|
return (
|
||||||
<ScrollView contentContainerStyle={stylesHook.root} keyboardShouldPersistTaps="always">
|
<ScrollView contentContainerStyle={[styles.root, stylesHook.root]} keyboardShouldPersistTaps="always">
|
||||||
<View style={stylesHook.scrollBody}>
|
<View style={styles.scrollBody}>
|
||||||
{isCustom && (
|
{isCustom && (
|
||||||
<>
|
<>
|
||||||
{getDisplayAmount() && (
|
{getDisplayAmount() && (
|
||||||
<BlueText testID="CustomAmountText" style={stylesHook.amount} numberOfLines={1}>
|
<BlueText testID="CustomAmountText" style={[styles.amount, stylesHook.amount]} numberOfLines={1}>
|
||||||
{getDisplayAmount()}
|
{getDisplayAmount()}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
)}
|
)}
|
||||||
{customLabel?.length > 0 && (
|
{customLabel?.length > 0 && (
|
||||||
<BlueText testID="CustomAmountDescriptionText" style={stylesHook.label} numberOfLines={1}>
|
<BlueText testID="CustomAmountDescriptionText" style={[styles.label, stylesHook.label]} numberOfLines={1}>
|
||||||
{customLabel}
|
{customLabel}
|
||||||
</BlueText>
|
</BlueText>
|
||||||
)}
|
)}
|
||||||
@ -321,10 +273,10 @@ const ReceiveDetails = () => {
|
|||||||
<QRCodeComponent value={bip21encoded} />
|
<QRCodeComponent value={bip21encoded} />
|
||||||
<BlueCopyTextToClipboard text={isCustom ? bip21encoded : address} />
|
<BlueCopyTextToClipboard text={isCustom ? bip21encoded : address} />
|
||||||
</View>
|
</View>
|
||||||
<View style={stylesHook.share}>
|
<View style={styles.share}>
|
||||||
<BlueCard>
|
<BlueCard>
|
||||||
<BlueButtonLink
|
<BlueButtonLink
|
||||||
style={stylesHook.link}
|
style={styles.link}
|
||||||
testID="SetCustomAmountButton"
|
testID="SetCustomAmountButton"
|
||||||
title={loc.receive.details_setAmount}
|
title={loc.receive.details_setAmount}
|
||||||
onPress={showCustomAmountModal}
|
onPress={showCustomAmountModal}
|
||||||
@ -453,16 +405,16 @@ const ReceiveDetails = () => {
|
|||||||
return (
|
return (
|
||||||
<BottomModal isVisible={isCustomModalVisible} onClose={dismissCustomAmountModal}>
|
<BottomModal isVisible={isCustomModalVisible} onClose={dismissCustomAmountModal}>
|
||||||
<KeyboardAvoidingView enabled={!Platform.isPad} behavior={Platform.OS === 'ios' ? 'position' : null}>
|
<KeyboardAvoidingView enabled={!Platform.isPad} behavior={Platform.OS === 'ios' ? 'position' : null}>
|
||||||
<View style={stylesHook.modalContent}>
|
<View style={[styles.modalContent, stylesHook.modalContent]}>
|
||||||
<AmountInput unit={customUnit} amount={customAmount || ''} onChangeText={setCustomAmount} onAmountUnitChange={setCustomUnit} />
|
<AmountInput unit={customUnit} amount={customAmount || ''} onChangeText={setCustomAmount} onAmountUnitChange={setCustomUnit} />
|
||||||
<View style={stylesHook.customAmount}>
|
<View style={[styles.customAmount, stylesHook.customAmount]}>
|
||||||
<TextInput
|
<TextInput
|
||||||
onChangeText={setCustomLabel}
|
onChangeText={setCustomLabel}
|
||||||
placeholderTextColor="#81868e"
|
placeholderTextColor="#81868e"
|
||||||
placeholder={loc.receive.details_label}
|
placeholder={loc.receive.details_label}
|
||||||
value={customLabel || ''}
|
value={customLabel || ''}
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
style={stylesHook.customAmountText}
|
style={[styles.customAmountText, stylesHook.customAmountText]}
|
||||||
testID="CustomAmountDescription"
|
testID="CustomAmountDescription"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -470,7 +422,7 @@ const ReceiveDetails = () => {
|
|||||||
<View>
|
<View>
|
||||||
<BlueButton
|
<BlueButton
|
||||||
testID="CustomAmountSaveButton"
|
testID="CustomAmountSaveButton"
|
||||||
style={stylesHook.modalButton}
|
style={[styles.modalButton, stylesHook.modalButton]}
|
||||||
title={loc.receive.details_create}
|
title={loc.receive.details_create}
|
||||||
onPress={createCustomAmountAddress}
|
onPress={createCustomAmountAddress}
|
||||||
/>
|
/>
|
||||||
@ -507,7 +459,7 @@ const ReceiveDetails = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={stylesHook.root}>
|
<View style={[styles.root, stylesHook.root]}>
|
||||||
<StatusBar barStyle="light-content" />
|
<StatusBar barStyle="light-content" />
|
||||||
{address !== undefined && showAddress && (
|
{address !== undefined && showAddress && (
|
||||||
<HandoffComponent
|
<HandoffComponent
|
||||||
@ -525,6 +477,68 @@ const ReceiveDetails = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
modalContent: {
|
||||||
|
padding: 22,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
borderTopLeftRadius: 16,
|
||||||
|
borderTopRightRadius: 16,
|
||||||
|
minHeight: 350,
|
||||||
|
height: 350,
|
||||||
|
},
|
||||||
|
customAmount: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
borderWidth: 1.0,
|
||||||
|
borderBottomWidth: 0.5,
|
||||||
|
minHeight: 44,
|
||||||
|
height: 44,
|
||||||
|
marginHorizontal: 20,
|
||||||
|
alignItems: 'center',
|
||||||
|
marginVertical: 8,
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
root: {
|
||||||
|
flexGrow: 1,
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
scrollBody: {
|
||||||
|
marginTop: 32,
|
||||||
|
flexGrow: 1,
|
||||||
|
alignItems: 'center',
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
},
|
||||||
|
share: {
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
paddingVertical: 16,
|
||||||
|
alignItems: 'center',
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
link: {
|
||||||
|
marginVertical: 16,
|
||||||
|
paddingHorizontal: 32,
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
fontWeight: '600',
|
||||||
|
fontSize: 36,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
fontWeight: '600',
|
||||||
|
textAlign: 'center',
|
||||||
|
paddingBottom: 24,
|
||||||
|
},
|
||||||
|
modalButton: {
|
||||||
|
paddingVertical: 14,
|
||||||
|
paddingHorizontal: 70,
|
||||||
|
maxWidth: '80%',
|
||||||
|
borderRadius: 50,
|
||||||
|
fontWeight: '700',
|
||||||
|
},
|
||||||
|
customAmountText: {
|
||||||
|
flex: 1,
|
||||||
|
marginHorizontal: 8,
|
||||||
|
minHeight: 33,
|
||||||
|
},
|
||||||
icon: {
|
icon: {
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 400,
|
height: 400,
|
||||||
|
Loading…
Reference in New Issue
Block a user