- Introduce ShowDialogOptions interface for customizable dialog actions - Update Dialog component to support onClose and onConfirm overrides - Add ConfirmPasswordDialog for password confirmation with custom actions - Integrate ConfirmPasswordDialog into Account settings for 2FA setup - Add new Key2CuteReIcon component for password confirmation UI - Update package.json and other files for new icon and dialog features Signed-off-by: Innei <tukon479@gmail.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { Text, View } from "react-native"
|
|
import { useColor } from "react-native-uikit-colors"
|
|
|
|
import { PlainTextField } from "@/src/components/ui/form/TextField"
|
|
import { Key2CuteReIcon } from "@/src/icons/key_2_cute_re"
|
|
import type { DialogComponent } from "@/src/lib/dialog"
|
|
import { Dialog } from "@/src/lib/dialog"
|
|
|
|
export const ConfirmPasswordDialog: DialogComponent<{
|
|
password: string
|
|
}> = ({ ctx }) => {
|
|
const label = useColor("label")
|
|
const { bizOnConfirm } = Dialog.useDialogContext()!
|
|
return (
|
|
<View>
|
|
<View className="flex-row items-center gap-2">
|
|
<Key2CuteReIcon color={label} height={20} width={20} />
|
|
<Text className="text-label text-base font-medium">Confirm your password to continue</Text>
|
|
</View>
|
|
<PlainTextField
|
|
autoFocus
|
|
autoCapitalize="none"
|
|
secureTextEntry
|
|
className="bg-system-background text-text my-3 rounded-xl p-2 px-4"
|
|
placeholder="Password"
|
|
onChangeText={(text) => (ctx.password = text)}
|
|
returnKeyType="done"
|
|
onSubmitEditing={() => {
|
|
bizOnConfirm?.()
|
|
}}
|
|
/>
|
|
</View>
|
|
)
|
|
}
|
|
|
|
ConfirmPasswordDialog.id = "confirm-password-dialog"
|
|
ConfirmPasswordDialog.confirmText = "Confirm"
|
|
ConfirmPasswordDialog.cancelText = "Cancel"
|
|
ConfirmPasswordDialog.onConfirm = (ctx) => {
|
|
ctx.dismiss()
|
|
}
|