REF: Icons to TSX

This commit is contained in:
Marcos Rodriguez Velez 2024-08-27 21:43:54 -04:00
parent 6afb5dbf51
commit 40810141b8
11 changed files with 46 additions and 38 deletions

View File

@ -36,7 +36,7 @@ export class LightningCustodianWallet extends LegacyWallet {
* @param URI * @param URI
*/ */
setBaseURI(URI: string | undefined) { setBaseURI(URI: string | undefined) {
this.baseURI = URI?.endsWith("/") ? URI.slice(0, -1) : URI; this.baseURI = URI?.endsWith('/') ? URI.slice(0, -1) : URI;
} }
getBaseURI() { getBaseURI() {
@ -579,7 +579,7 @@ export class LightningCustodianWallet extends LegacyWallet {
} }
static async isValidNodeAddress(address: string) { static async isValidNodeAddress(address: string) {
const response = await fetch((address?.endsWith("/") ? address.slice(0, -1) : address) + '/getinfo', { const response = await fetch((address?.endsWith('/') ? address.slice(0, -1) : address) + '/getinfo', {
method: 'GET', method: 'GET',
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',

View File

@ -1,7 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, Text, View } from 'react-native'; import { StyleSheet, Text, View } from 'react-native';
import loc from '../loc';
import PlusIcon from './icons/PlusIcon'; import PlusIcon from './icons/PlusIcon';
import { useTheme } from './themes'; import { useTheme } from './themes';
@ -27,7 +25,7 @@ export const Header: React.FC<HeaderProps> = ({ leftText, isDrawerList, onNewWal
return ( return (
<View style={[styles.root, styleWithProps.root]}> <View style={[styles.root, styleWithProps.root]}>
<Text style={[styles.text, styleWithProps.text]}>{leftText}</Text> <Text style={[styles.text, styleWithProps.text]}>{leftText}</Text>
{onNewWalletPress && <PlusIcon accessibilityRole="button" accessibilityLabel={loc.wallets.add_title} onPress={onNewWalletPress} />} {onNewWalletPress && <PlusIcon onPress={onNewWalletPress} />}
</View> </View>
); );
}; };

View File

@ -1,8 +1,13 @@
import React from 'react'; import React from 'react';
import { StyleSheet, TouchableOpacity } from 'react-native'; import { StyleSheet, TouchableOpacity, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
import loc from '../../loc';
type PlusIconProps = {
onPress: () => void;
};
const styles = StyleSheet.create({ const styles = StyleSheet.create({
ball: { ball: {
@ -11,10 +16,10 @@ const styles = StyleSheet.create({
borderRadius: 15, borderRadius: 15,
justifyContent: 'center', justifyContent: 'center',
alignContent: 'center', alignContent: 'center',
}, } as ViewStyle,
}); });
const PlusIcon = props => { const PlusIcon: React.FC<PlusIconProps> = ({ onPress }) => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHook = StyleSheet.create({ const stylesHook = StyleSheet.create({
ball: { ball: {
@ -23,7 +28,12 @@ const PlusIcon = props => {
}); });
return ( return (
<TouchableOpacity style={[styles.ball, stylesHook.ball]} onPress={props.onPress}> <TouchableOpacity
style={[styles.ball, stylesHook.ball]}
accessibilityLabel={loc.wallets.add_title}
onPress={onPress}
accessibilityRole="button"
>
<Icon name="add" size={22} type="ionicons" color={colors.foregroundColor} /> <Icon name="add" size={22} type="ionicons" color={colors.foregroundColor} />
</TouchableOpacity> </TouchableOpacity>
); );

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,20 +7,20 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ballOutgoingExpired: { ballOutgoingExpired: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
justifyContent: 'center', justifyContent: 'center',
}, } as ViewStyle,
icon: { icon: {
left: 0, left: 0,
top: 0, top: 0,
}, },
}); });
const TransactionExpiredIcon = props => { const TransactionExpiredIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHooks = StyleSheet.create({ const stylesHooks = StyleSheet.create({
ballOutgoingExpired: { ballOutgoingExpired: {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,17 +7,17 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ballIncoming: { ballIncoming: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
transform: [{ rotate: '-45deg' }], transform: [{ rotate: '-45deg' }],
justifyContent: 'center', justifyContent: 'center',
}, } as ViewStyle,
}); });
const TransactionIncomingIcon = props => { const TransactionIncomingIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHooks = StyleSheet.create({ const stylesHooks = StyleSheet.create({
ballIncoming: { ballIncoming: {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,19 +7,19 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ballOutgoingWithoutRotate: { ballOutgoingWithoutRotate: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
}, } as ViewStyle,
icon: { icon: {
left: 0, left: 0,
marginTop: 6, marginTop: 6,
}, },
}); });
const TransactionOffchainIcon = props => { const TransactionOffchainIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHooks = StyleSheet.create({ const stylesHooks = StyleSheet.create({
ballOutgoingWithoutRotate: { ballOutgoingWithoutRotate: {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,19 +7,19 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ballIncomingWithoutRotate: { ballIncomingWithoutRotate: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
}, } as ViewStyle,
icon: { icon: {
left: 0, left: 0,
marginTop: 6, marginTop: 6,
}, },
}); });
const TransactionOffchainIncomingIcon = props => { const TransactionOffchainIncomingIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHooks = StyleSheet.create({ const stylesHooks = StyleSheet.create({
ballIncomingWithoutRotate: { ballIncomingWithoutRotate: {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,14 +7,14 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ballIncoming: { ballIncoming: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
transform: [{ rotate: '-45deg' }], transform: [{ rotate: '-45deg' }],
justifyContent: 'center', justifyContent: 'center',
}, } as ViewStyle,
icon: { icon: {
left: 0, left: 0,
top: 0, top: 0,
@ -22,7 +22,7 @@ const styles = StyleSheet.create({
}, },
}); });
const TransactionOnchainIcon = props => { const TransactionOnchainIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesBlueIconHooks = StyleSheet.create({ const stylesBlueIconHooks = StyleSheet.create({
ballIncoming: { ballIncoming: {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,17 +7,17 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ballOutgoing: { ballOutgoing: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
transform: [{ rotate: '225deg' }], transform: [{ rotate: '225deg' }],
justifyContent: 'center', justifyContent: 'center',
}, } as ViewStyle,
}); });
const TransactionOutgoingIcon = props => { const TransactionOutgoingIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesBlueIconHooks = StyleSheet.create({ const stylesBlueIconHooks = StyleSheet.create({
ballOutgoing: { ballOutgoing: {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View, ViewStyle } from 'react-native';
import { Icon } from '@rneui/themed'; import { Icon } from '@rneui/themed';
import { useTheme } from '../themes'; import { useTheme } from '../themes';
@ -7,19 +7,19 @@ import { useTheme } from '../themes';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
boxIncoming: { boxIncoming: {
position: 'relative', position: 'relative',
}, } as ViewStyle,
ball: { ball: {
width: 30, width: 30,
height: 30, height: 30,
borderRadius: 15, borderRadius: 15,
}, } as ViewStyle,
icon: { icon: {
left: 0, left: 0,
top: 7, top: 7,
}, },
}); });
const TransactionPendingIcon = props => { const TransactionPendingIcon: React.FC = () => {
const { colors } = useTheme(); const { colors } = useTheme();
const stylesHook = StyleSheet.create({ const stylesHook = StyleSheet.create({
ball: { ball: {

View File

@ -83,7 +83,7 @@ const DetailViewStackScreensStack = () => {
const RightBarButtons = useMemo( const RightBarButtons = useMemo(
() => ( () => (
<> <>
<PlusIcon accessibilityRole="button" accessibilityLabel={loc.wallets.add_title} onPress={navigateToAddWallet} /> <PlusIcon onPress={navigateToAddWallet} />
<View style={styles.width24} /> <View style={styles.width24} />
<SettingsButton /> <SettingsButton />
</> </>