diff --git a/app/(site)/docs/components/input/page.tsx b/app/(site)/docs/components/input/page.tsx new file mode 100644 index 0000000..30ed99b --- /dev/null +++ b/app/(site)/docs/components/input/page.tsx @@ -0,0 +1,69 @@ +import { ComponentPreview } from "@/components/docs/component-preview"; + +export default function InputPage() { + return ( + \n Click me\n \n );\n}", + "language": "tsx" + } +]} + componentCode={`import * as React from "react"; +import { TextInput, Platform } from "react-native"; +import { cn } from "@/lib/utils"; + +const Input = React.forwardRef< + TextInput, + React.ComponentProps +>(({ className, ...props }, ref) => { + const [isFocused, setIsFocused] = React.useState(false); + + return ( + setIsFocused(true)} + onBlur={() => setIsFocused(false)} + {...props} + /> + ); +}); + +Input.displayName = "Input"; + +export { Input }; +`} + previewCode={`import { Input } from "@nativeui/ui"; + +export default function InputDemo() { + return ( +
+ Default Input + Delete + Outline + Secondary + Ghost + Link +
+ ); +}`} + registryName="input" + packageName="@nativeui/ui" + /> + ); +} diff --git a/public/r/input.json b/public/r/input.json new file mode 100644 index 0000000..94263d2 --- /dev/null +++ b/public/r/input.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "input", + "type": "registry:component", + "title": "Input", + "description": "An input component for React Native applications.", + "dependencies": [ + "react-native" + ], + "registryDependencies": [], + "files": [ + { + "path": "registry/input/input.tsx", + "content": "import * as React from \"react\";\nimport { TextInput, Platform } from \"react-native\";\nimport { cn } from \"@/lib/utils\";\n\nconst Input = React.forwardRef<\n TextInput,\n React.ComponentProps\n>(({ className, ...props }, ref) => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n return (\n setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n {...props}\n />\n );\n});\n\nInput.displayName = \"Input\";\n\nexport { Input };\n", + "type": "registry:component" + } + ] +} \ No newline at end of file diff --git a/registry.json b/registry.json index 6f7d236..fe1e92e 100644 --- a/registry.json +++ b/registry.json @@ -58,6 +58,20 @@ ], "dependencies": ["react-native"], "registryDependencies": [] + }, + { + "name": "input", + "type": "registry:component", + "title": "Input", + "description": "An input component for React Native applications.", + "files": [ + { + "path": "registry/input/input.tsx", + "type": "registry:component" + } + ], + "dependencies": ["react-native"], + "registryDependencies": [] } ] } diff --git a/registry/input/input.tsx b/registry/input/input.tsx new file mode 100644 index 0000000..b4bffe7 --- /dev/null +++ b/registry/input/input.tsx @@ -0,0 +1,34 @@ +import * as React from "react"; +import { TextInput, Platform } from "react-native"; +import { cn } from "@/lib/utils"; + +const Input = React.forwardRef< + TextInput, + React.ComponentProps +>(({ className, ...props }, ref) => { + const [isFocused, setIsFocused] = React.useState(false); + + return ( + setIsFocused(true)} + onBlur={() => setIsFocused(false)} + {...props} + /> + ); +}); + +Input.displayName = "Input"; + +export { Input };