浏览代码

fix text_field creating number input (#5126)

* fix text_field creating number input

* only do it on cls is Input
Khaleel Al-Adhami 1 月之前
父节点
当前提交
f821ce3215
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      reflex/components/el/elements/forms.py

+ 8 - 7
reflex/components/el/elements/forms.py

@@ -460,15 +460,16 @@ class Input(BaseInput):
                 value_var.is_not_none(), value_var, Var.create("")
                 value_var.is_not_none(), value_var, Var.create("")
             )
             )
 
 
-        input_type = props.get("type")
+        if cls is Input:
+            input_type = props.get("type")
 
 
-        if input_type == "checkbox":
-            # Checkbox inputs should use the CheckboxInput class
-            return CheckboxInput.create(*children, **props)
+            if input_type == "checkbox":
+                # Checkbox inputs should use the CheckboxInput class
+                return CheckboxInput.create(*children, **props)
 
 
-        if input_type == "number" or input_type == "range":
-            # Number inputs should use the ValueNumberInput class
-            return ValueNumberInput.create(*children, **props)
+            if input_type == "number" or input_type == "range":
+                # Number inputs should use the ValueNumberInput class
+                return ValueNumberInput.create(*children, **props)
 
 
         return super().create(*children, **props)
         return super().create(*children, **props)