Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions fe1-web/src/core/components/CopiableTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ const styles = StyleSheet.create({
} as TextStyle,
});

const CopiableTextInput = (props: IPropTypes) => {
const { text, negative } = props;

const CopiableTextInput = ({ text, negative }: IPropTypes) => {
return (
<View style={styles.view}>
<TextInput
Expand Down
6 changes: 3 additions & 3 deletions fe1-web/src/core/components/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import * as Clipboard from 'expo-clipboard';
import PropTypes from 'prop-types';
import React from 'react';
import { Pressable } from 'react-native';

import { Color } from 'core/styles';

import PoPIcon from './PoPIcon';
import PoPTouchableOpacity from './PoPTouchableOpacity';

/**
* Copy to clipboard button
*/

function CopyButton({ data, negative, testID }: IPropTypes) {
return (
<Pressable onPress={() => Clipboard.setStringAsync(data)} testID={testID!}>
<PoPTouchableOpacity onPress={() => Clipboard.setStringAsync(data)} testID={testID}>
<PoPIcon name="copy" color={negative ? Color.contrast : Color.primary} size={26} />
</Pressable>
</PoPTouchableOpacity>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,32 @@ exports[`CopyButton renders correctly 1`] = `
onStartShouldSetResponder={[Function]}
testID="copyButton"
>
<View>
{"name":"ios-copy","size":26,"color":"#000"}
</View>
<RNGestureHandlerButton
collapsable={false}
exclusive={true}
handlerTag={1}
handlerType="NativeViewGestureHandler"
onGestureEvent={[Function]}
onGestureHandlerEvent={[Function]}
onGestureHandlerStateChange={[Function]}
onHandlerStateChange={[Function]}
rippleColor={0}
touchSoundDisabled={false}
>
<View
accessible={true}
collapsable={false}
style={
Object {
"opacity": 1,
}
}
>
<View>
{"name":"ios-copy","size":26,"color":"#000"}
</View>
</View>
</RNGestureHandlerButton>
</View>
`;

Expand All @@ -38,8 +61,31 @@ exports[`CopyButton renders correctly when negative 1`] = `
onStartShouldSetResponder={[Function]}
testID="copyButton"
>
<View>
{"name":"ios-copy","size":26,"color":"#fff"}
</View>
<RNGestureHandlerButton
collapsable={false}
exclusive={true}
handlerTag={2}
handlerType="NativeViewGestureHandler"
onGestureEvent={[Function]}
onGestureHandlerEvent={[Function]}
onGestureHandlerStateChange={[Function]}
onHandlerStateChange={[Function]}
rippleColor={0}
touchSoundDisabled={false}
>
<View
accessible={true}
collapsable={false}
style={
Object {
"opacity": 1,
}
}
>
<View>
{"name":"ios-copy","size":26,"color":"#fff"}
</View>
</View>
</RNGestureHandlerButton>
</View>
`;
11 changes: 10 additions & 1 deletion fe1-web/src/features/wallet/screens/WalletCreateSeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useEffect, useState } from 'react';
import { StyleSheet, Text, TextStyle, View, ViewStyle } from 'react-native';
import { useToast } from 'react-native-toast-notifications';

import { CopyButton } from 'core/components';
import ScreenWrapper from 'core/components/ScreenWrapper';
import { ToolbarItem } from 'core/components/Toolbar';
import { AppScreen } from 'core/navigation/AppNavigation';
Expand All @@ -22,6 +23,11 @@ const styles = StyleSheet.create({
backgroundColor: Color.accent,
marginBottom: Spacing.x1,
padding: Spacing.x1,

display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
} as ViewStyle,
seed: {
...Typography.base,
Expand Down Expand Up @@ -116,7 +122,10 @@ const WalletCreateSeed = () => {
<Text>{STRINGS.wallet_welcome_text_wallet_explanation_4}</Text>
</Text>
<View style={styles.words}>
<Text style={styles.seed}>{seed}</Text>
<Text style={styles.seed} selectable>
{seed}
</Text>
<CopyButton data={seed} negative />
</View>
<Text style={Typography.paragraph}>
<Text>{STRINGS.wallet_welcome_text_wallet_explanation_5}</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,19 @@ exports[`Wallet create seed screen renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#3742fa",
"borderRadius": 8,
"display": "flex",
"flexDirection": "row",
"justifyContent": "space-between",
"marginBottom": 16,
"padding": 16,
}
}
>
<Text
selectable={true}
style={
Object {
"color": "#fff",
Expand All @@ -471,6 +476,48 @@ exports[`Wallet create seed screen renders correctly 1`] = `
>
one two three
</Text>
<View
accessible={true}
collapsable={false}
focusable={true}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
testID="copyButton"
>
<RNGestureHandlerButton
collapsable={false}
exclusive={true}
handlerTag={3}
handlerType="NativeViewGestureHandler"
onGestureEvent={[Function]}
onGestureHandlerEvent={[Function]}
onGestureHandlerStateChange={[Function]}
onHandlerStateChange={[Function]}
rippleColor={0}
touchSoundDisabled={false}
>
<View
accessible={true}
collapsable={false}
style={
Object {
"opacity": 1,
}
}
>
<View>
{"name":"ios-copy","size":26,"color":"#fff"}
</View>
</View>
</RNGestureHandlerButton>
</View>
</View>
<Text
style={
Expand Down Expand Up @@ -588,7 +635,7 @@ exports[`Wallet create seed screen renders correctly 1`] = `
<RNGestureHandlerButton
collapsable={false}
exclusive={true}
handlerTag={3}
handlerTag={4}
handlerType="NativeViewGestureHandler"
onGestureEvent={[Function]}
onGestureHandlerEvent={[Function]}
Expand Down Expand Up @@ -668,7 +715,7 @@ exports[`Wallet create seed screen renders correctly 1`] = `
<RNGestureHandlerButton
collapsable={false}
exclusive={true}
handlerTag={4}
handlerTag={5}
handlerType="NativeViewGestureHandler"
onGestureEvent={[Function]}
onGestureHandlerEvent={[Function]}
Expand Down