|
|
@@ -1,4 +1,4 @@
|
|
|
-import { Input as TaroInput, InputProps as TaroInputProps } from '@tarojs/components'
|
|
|
+import { Input as TaroInput, InputProps as TaroInputProps, View, Text } from '@tarojs/components'
|
|
|
import { cn } from '@/utils/cn'
|
|
|
import { cva, type VariantProps } from 'class-variance-authority'
|
|
|
import { forwardRef } from 'react'
|
|
|
@@ -34,15 +34,15 @@ export interface InputProps extends Omit<TaroInputProps, 'className'>, VariantPr
|
|
|
errorMessage?: string
|
|
|
}
|
|
|
|
|
|
-const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
+const Input = forwardRef<any, InputProps>(
|
|
|
({ className, variant, size, leftIcon, rightIcon, error, errorMessage, ...props }, ref) => {
|
|
|
return (
|
|
|
- <div className="w-full">
|
|
|
- <div className="relative">
|
|
|
+ <View className="w-full">
|
|
|
+ <View className="relative">
|
|
|
{leftIcon && (
|
|
|
- <div className="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
|
- <div className={cn('w-5 h-5 text-gray-400', leftIcon)} />
|
|
|
- </div>
|
|
|
+ <View className="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
|
+ <View className={cn('w-5 h-5 text-gray-400', leftIcon)} />
|
|
|
+ </View>
|
|
|
)}
|
|
|
|
|
|
<TaroInput
|
|
|
@@ -57,16 +57,16 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
|
/>
|
|
|
|
|
|
{rightIcon && (
|
|
|
- <div className="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
|
- <div className={cn('w-5 h-5 text-gray-400', rightIcon)} />
|
|
|
- </div>
|
|
|
+ <View className="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
|
+ <View className={cn('w-5 h-5 text-gray-400', rightIcon)} />
|
|
|
+ </View>
|
|
|
)}
|
|
|
- </div>
|
|
|
+ </View>
|
|
|
|
|
|
{error && errorMessage && (
|
|
|
- <p className="mt-1 text-sm text-red-600">{errorMessage}</p>
|
|
|
+ <Text className="mt-1 text-sm text-red-600">{errorMessage}</Text>
|
|
|
)}
|
|
|
- </div>
|
|
|
+ </View>
|
|
|
)
|
|
|
}
|
|
|
)
|