diff --git a/packages/components/src/forms/index.ts b/packages/components/src/forms/index.ts index 4a7686ba37d..3cc60514688 100644 --- a/packages/components/src/forms/index.ts +++ b/packages/components/src/forms/index.ts @@ -6,4 +6,5 @@ export * from './Select'; export * from './Slider'; export * from './Switch'; export * from './TextArea'; +export * from './PinCodeValidator'; export * from './types'; diff --git a/packages/kit/src/components/Password/components/PassCodeInput.tsx b/packages/kit/src/components/Password/components/PassCodeInput.tsx index 07ff22acdea..13b9f4b686b 100644 --- a/packages/kit/src/components/Password/components/PassCodeInput.tsx +++ b/packages/kit/src/components/Password/components/PassCodeInput.tsx @@ -3,31 +3,14 @@ import { useEffect, useState } from 'react'; import { StyleSheet, Text } from 'react-native'; import { CodeField, - Cursor, useBlurOnFulfill, useClearByFocusCell, } from 'react-native-confirmation-code-field'; -import { IconButton, XStack } from '@onekeyhq/components'; +import { YStack } from '@onekeyhq/components'; export const PIN_CELL_COUNT = 6; -const cellStyles = StyleSheet.create({ - cell: { - flex: 1, - fontSize: 30, - fontWeight: '700', - textAlign: 'center', - marginRight: 8, - borderRadius: 20, - borderWidth: 1, - borderColor: '#eee', - }, - focusCell: { - borderColor: '#000', - }, -}); - const PassCodeInput = ({ onPinCodeChange, onComplete, @@ -57,6 +40,14 @@ const PassCodeInput = ({ }); const [enableMask, setEnableMask] = useState(true); const toggleMask = () => setEnableMask((f) => !f); + + const cellStyles = StyleSheet.create({ + cell: { + width: 16, + height: 16, + }, + }); + const renderCell = ({ index, symbol, @@ -65,28 +56,33 @@ const PassCodeInput = ({ index: number; symbol: string; isFocused: boolean; - }) => { - let textChild = null; - if (symbol) { - textChild = enableMask ? '•' : symbol; - } else if (isFocused) { - textChild = ; - } - - return ( - - {textChild} - - ); - }; + }) => ( + // let textChild = null; + // if (symbol) { + // textChild = enableMask ? '•' : symbol; + // } + + {/* {symbol ? ( + + ) : ( + '' + )} */} + + + ); useEffect(() => { if (pinCodeFocus) { pinInputRef.current?.focus(); @@ -94,33 +90,39 @@ const PassCodeInput = ({ }, [pinCodeFocus, pinInputRef]); return ( - - { - setPinValue(text); - onPinCodeChange?.(text); - if (text.length === PIN_CELL_COUNT && !disabledComplete) { - onComplete?.(); - } - }} - cellCount={PIN_CELL_COUNT} - keyboardType="number-pad" - textContentType="oneTimeCode" - renderCell={renderCell} - /> - {showMask ? ( - - ) : null} - + { + setPinValue(text); + onPinCodeChange?.(text); + if (text.length === PIN_CELL_COUNT && !disabledComplete) { + onComplete?.(); + } + }} + cellCount={PIN_CELL_COUNT} + keyboardType="number-pad" + textContentType="oneTimeCode" + renderCell={renderCell} + {...props} + /> + + // + // {showMask ? ( + // + // ) : null} + // ); }; diff --git a/packages/kit/src/components/Password/components/PassCodeProtectionDialogContent.tsx b/packages/kit/src/components/Password/components/PassCodeProtectionDialogContent.tsx index c70e344cf37..7fa0f4e4846 100644 --- a/packages/kit/src/components/Password/components/PassCodeProtectionDialogContent.tsx +++ b/packages/kit/src/components/Password/components/PassCodeProtectionDialogContent.tsx @@ -1,6 +1,6 @@ import { useIntl } from 'react-intl'; -import { SizableText, XStack, YStack } from '@onekeyhq/components'; +import { SizableText, XStack } from '@onekeyhq/components'; import { ETranslations } from '@onekeyhq/shared/src/locale'; import PassCodeProtectionSwitch from '../container/PassCodeProtectionSwitch'; @@ -8,21 +8,14 @@ import PassCodeProtectionSwitch from '../container/PassCodeProtectionSwitch'; const PassCodeProtectionDialogContent = () => { const intl = useIntl(); return ( - - + + {intl.formatMessage({ - id: ETranslations.auth_Passcode_protection_description, + id: ETranslations.Setting_Reset_app_description, })} - - - {intl.formatMessage({ - id: ETranslations.Setting_Reset_app_description, - })} - - - - + + ); }; diff --git a/packages/kit/src/components/Password/components/PasswordSetup.tsx b/packages/kit/src/components/Password/components/PasswordSetup.tsx index 02209b11f20..8307c8c57e2 100644 --- a/packages/kit/src/components/Password/components/PasswordSetup.tsx +++ b/packages/kit/src/components/Password/components/PasswordSetup.tsx @@ -2,7 +2,14 @@ import { memo, useEffect, useMemo, useState } from 'react'; import { useIntl } from 'react-intl'; -import { Button, Form, Input, Unspaced, useForm } from '@onekeyhq/components'; +import { + Button, + Divider, + Form, + Input, + Unspaced, + useForm, +} from '@onekeyhq/components'; import { EPasswordMode } from '@onekeyhq/kit-bg/src/services/ServicePassword/types'; import { ETranslations } from '@onekeyhq/shared/src/locale'; import platformEnv from '@onekeyhq/shared/src/platformEnv'; @@ -193,9 +200,6 @@ const PasswordSetup = ({ ) : ( <> + )} @@ -299,8 +301,8 @@ const PasswordSetup = ({ {platformEnv.isNative ? (