Skip to content

Commit

Permalink
Merge branch 'main' into feat/batch_1129_segment_17
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMassart committed Feb 28, 2024
2 parents 262a099 + 70eff9c commit a51667b
Show file tree
Hide file tree
Showing 55 changed files with 423 additions and 164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ exports[`CustomSpendCap should match snapshot 1`] = `
</View>
</View>
<Text
accessibilityRole="text"
accessibilityRole="link"
accessible={true}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down Expand Up @@ -220,7 +221,8 @@ exports[`CustomSpendCap should match snapshot 1`] = `
This allows the third party to spend all your token balance until it reaches the cap or you revoke the spending cap. If this is not intended, consider setting a lower spending cap.
<Text
accessibilityRole="text"
accessibilityRole="link"
accessible={true}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ exports[`Banner should render correctly with a close button 1`] = `
Sample Banner Description
</Text>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down Expand Up @@ -385,6 +387,8 @@ exports[`Banner should render correctly with an action button 1`] = `
Sample Banner Description
</Text>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ exports[`BannerAlert should render BannerAlert 1`] = `
Sample Banner Alert Description
</Text>
<Text
accessibilityRole="text"
accessibilityRole="link"
accessible={true}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ exports[`BannerTip should render default settings correctly 1`] = `
Sample Banner Tip Description
</Text>
<Text
accessibilityRole="text"
accessibilityRole="link"
accessible={true}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ exports[`BottomSheetFooter should render snapshot correctly 1`] = `
testID="bottomsheetfooter"
>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down Expand Up @@ -52,6 +54,8 @@ exports[`BottomSheetFooter should render snapshot correctly 1`] = `
</Text>
</TouchableOpacity>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const ButtonBase = ({
activeOpacity={1}
onPress={onPress}
style={styles.base}
accessibilityRole="button"
accessible
{...props}
>
{startIconName && (
Expand All @@ -59,6 +61,7 @@ const ButtonBase = ({
<Text
variant={DEFAULT_BUTTONBASE_LABEL_TEXTVARIANT}
style={styles.label}
accessibilityRole="none"
>
{label}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

exports[`ButtonBase should render correctly 1`] = `
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
style={
Expand All @@ -28,6 +30,7 @@ exports[`ButtonBase should render correctly 1`] = `
}
/>
<Text
accessibilityRole="none"
style={
Object {
"color": "#24272A",
Expand All @@ -42,6 +45,8 @@ exports[`ButtonBase should render correctly 1`] = `

exports[`ButtonBase should render correctly when disabled 1`] = `
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
disabled={true}
onPress={[Function]}
Expand Down Expand Up @@ -70,6 +75,7 @@ exports[`ButtonBase should render correctly when disabled 1`] = `
}
/>
<Text
accessibilityRole="none"
style={
Object {
"color": "#24272A",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Third party dependencies.
import { StyleSheet, TextStyle, ViewStyle } from 'react-native';
import { StyleSheet, ViewStyle } from 'react-native';

// External dependencies.
import { colors } from '../../../../../../styles/common';
Expand All @@ -24,10 +24,7 @@ const styleSheet = (params: { vars: ButtonLinkStyleSheetVars }) => {
{ backgroundColor: colors.transparent },
style,
) as ViewStyle,
pressedText: Object.assign(
{ textDecorationLine: 'underline' } as TextStyle,
style,
) as TextStyle,
pressedText: { textDecorationLine: 'underline' },
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const ButtonLink: React.FC<ButtonLinkProps> = ({
onPressIn={triggerOnPressedIn}
onPressOut={triggerOnPressedOut}
accessibilityRole="link"
accessible
{...props}
>
{renderLabel()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ exports[`Link should render correctly 1`] = `
<Fragment>
<Text
accessibilityRole="link"
accessible={true}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
2 changes: 1 addition & 1 deletion app/component-library/components/Texts/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Text: React.FC<TextProps> = ({
}) => {
const { styles } = useStyles(styleSheet, { variant, style, color });
return (
<RNText {...props} style={styles.base} accessibilityRole="text">
<RNText accessibilityRole="text" {...props} style={styles.base}>
{children}
</RNText>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ exports[`CollectibleModal should render correctly 1`] = `
}
>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down
31 changes: 20 additions & 11 deletions app/components/UI/NetworkModal/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -234,27 +234,32 @@ exports[`NetworkDetails renders correctly 1`] = `
<View
style={
Object {
"backgroundColor": "#FFFFFF",
"alignItems": "center",
"backgroundColor": "#F2F4F6",
"borderRadius": 8,
"borderWidth": 1,
"height": 16,
"justifyContent": "center",
"overflow": "hidden",
"width": 16,
}
}
>
<Image
onError={[Function]}
resizeMode="contain"
source="image"
<Text
accessibilityRole="text"
style={
Object {
"flex": 1,
"height": undefined,
"width": undefined,
"color": "#24272A",
"fontFamily": "Euclid Circular B",
"fontSize": 10,
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": undefined,
}
}
testID="network-avatar-image"
/>
>
T
</Text>
</View>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -420,7 +425,7 @@ exports[`NetworkDetails renders correctly 1`] = `
}
}
>
https://localhost:8545
https:/
</Text>
<TouchableOpacity
activeOpacity={0.5}
Expand Down Expand Up @@ -499,6 +504,8 @@ exports[`NetworkDetails renders correctly 1`] = `
testID="bottomsheetfooter"
>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down Expand Up @@ -538,6 +545,8 @@ exports[`NetworkDetails renders correctly 1`] = `
</Text>
</TouchableOpacity>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPress={[Function]}
onPressIn={[Function]}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/prop-types */
import React, { useCallback, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { View, Linking } from 'react-native';
import { strings } from '../../../../locales/i18n';
import { CommonSelectorsIDs } from '../../../../e2e/selectors/Common.selectors';
Expand Down Expand Up @@ -28,8 +28,12 @@ import BottomSheetFooter, {
ButtonsAlignment,
} from '../../../component-library/components/BottomSheets/BottomSheetFooter';
import BottomSheetHeader from '../../../component-library/components/BottomSheets/BottomSheetHeader';
import { toggleUseSafeChainsListValidation } from '../../../util/networks';
import {
getNetworkImageSource,
toggleUseSafeChainsListValidation,
} from '../../../util/networks';
import { NetworkApprovalModalSelectorsIDs } from '../../../../e2e/selectors/Modals/NetworkApprovalModal.selectors';
import hideKeyFromUrl from '../../../util/hideKeyFromUrl';

interface Alert {
alertError: string;
Expand Down Expand Up @@ -67,6 +71,15 @@ const NetworkVerificationInfo = ({

useEffect(() => setAlerts(alertsFromProps), [alertsFromProps]);

const networkImageSource = useMemo(
() =>
//@ts-expect-error - The utils/network file is still JS and this function expects a networkType, and should be optional
getNetworkImageSource({
chainId: customNetworkInformation.chainId,
}),
[customNetworkInformation],
);

const renderNetworkInfo = () => (
<ScrollView
nestedScrollEnabled
Expand Down Expand Up @@ -98,7 +111,9 @@ const NetworkVerificationInfo = ({
<Text variant={TextVariant.BodyMDBold}>
{strings('add_custom_network.network_url')}
</Text>
<Text style={styles.textSection}>{customNetworkInformation.rpcUrl}</Text>
<Text style={styles.textSection}>
{hideKeyFromUrl(customNetworkInformation.rpcUrl)}
</Text>

<Accordion
title={strings('spend_limit_edition.view_details')}
Expand Down Expand Up @@ -149,6 +164,7 @@ const NetworkVerificationInfo = ({
const renderAlerts = useCallback(() => {
if (!safeChainsListValidationEnabled) return null;
if (!alerts.length) return null;

return alerts.map(
(
networkAlert: {
Expand Down Expand Up @@ -229,7 +245,7 @@ const NetworkVerificationInfo = ({
</BottomSheetHeader>
<ScrollView style={styles.root}>
<PickerNetwork
imageSource={customNetworkInformation.icon}
imageSource={networkImageSource}
label={customNetworkInformation.chainName}
style={styles.networkSection}
disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,32 @@ exports[`NetworkVerificationInfo renders correctly 1`] = `
<View
style={
Object {
"backgroundColor": "#FFFFFF",
"alignItems": "center",
"backgroundColor": "#F2F4F6",
"borderRadius": 8,
"borderWidth": 1,
"height": 16,
"justifyContent": "center",
"overflow": "hidden",
"width": 16,
}
}
>
<Image
onError={[Function]}
resizeMode="contain"
source="test-icon"
<Text
accessibilityRole="text"
style={
Object {
"flex": 1,
"height": undefined,
"width": undefined,
"color": "#24272A",
"fontFamily": "Euclid Circular B",
"fontSize": 10,
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": undefined,
}
}
testID="network-avatar-image"
/>
>
T
</Text>
</View>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -379,7 +384,7 @@ exports[`NetworkVerificationInfo renders correctly 1`] = `
}
}
>
http://test.com
http:/
</Text>
<TouchableOpacity
activeOpacity={0.5}
Expand Down Expand Up @@ -458,6 +463,8 @@ exports[`NetworkVerificationInfo renders correctly 1`] = `
testID="bottomsheetfooter"
>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down Expand Up @@ -496,6 +503,8 @@ exports[`NetworkVerificationInfo renders correctly 1`] = `
</Text>
</TouchableOpacity>
<TouchableOpacity
accessibilityRole="button"
accessible={true}
activeOpacity={1}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
Loading

0 comments on commit a51667b

Please sign in to comment.