From 469119398ad5ad42dced589216720302c7b8ff41 Mon Sep 17 00:00:00 2001 From: Theo2903 Date: Tue, 29 Apr 2025 15:26:22 +0200 Subject: [PATCH] Add Textarea component to registry - Introduced a new Textarea component for React Native applications, including its implementation in `registry/textarea/textarea.tsx`. - Updated `registry.json` to include the new Textarea component and its dependencies. --- app/(site)/docs/components/textarea/page.tsx | 71 ++++++++++++++++++++ public/r/textarea.json | 18 +++++ registry.json | 14 ++++ registry/textarea/textarea.tsx | 36 ++++++++++ 4 files changed, 139 insertions(+) create mode 100644 app/(site)/docs/components/textarea/page.tsx create mode 100644 public/r/textarea.json create mode 100644 registry/textarea/textarea.tsx diff --git a/app/(site)/docs/components/textarea/page.tsx b/app/(site)/docs/components/textarea/page.tsx new file mode 100644 index 0000000..47d072f --- /dev/null +++ b/app/(site)/docs/components/textarea/page.tsx @@ -0,0 +1,71 @@ +import { ComponentPreview } from "@/components/docs/component-preview"; + +export default function TextareaPage() { + 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 TextArea = React.forwardRef< + TextInput, + React.ComponentProps +>(({ className, ...props }, ref) => { + const [isFocused, setIsFocused] = React.useState(false); + + return ( + setIsFocused(true)} + onBlur={() => setIsFocused(false)} + {...props} + /> + ); +}); + +TextArea.displayName = "TextArea"; + +export { TextArea }; +`} + previewCode={`import { Textarea } from "@nativeui/ui"; + +export default function TextareaDemo() { + return ( +
+ + + + + + +
+ ); +}`} + registryName="textarea" + packageName="@nativeui/ui" + /> + ); +} diff --git a/public/r/textarea.json b/public/r/textarea.json new file mode 100644 index 0000000..b4916f2 --- /dev/null +++ b/public/r/textarea.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://ui.shadcn.com/schema/registry-item.json", + "name": "textarea", + "type": "registry:component", + "title": "Textarea", + "description": "A textarea component for React Native applications.", + "dependencies": [ + "react-native" + ], + "registryDependencies": [], + "files": [ + { + "path": "registry/textarea/textarea.tsx", + "content": "import * as React from \"react\";\nimport { TextInput, Platform } from \"react-native\";\nimport { cn } from \"@/lib/utils\";\n\nconst TextArea = 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\nTextArea.displayName = \"TextArea\";\n\nexport { TextArea };\n", + "type": "registry:component" + } + ] +} \ No newline at end of file diff --git a/registry.json b/registry.json index fe1e92e..eb9a7a2 100644 --- a/registry.json +++ b/registry.json @@ -72,6 +72,20 @@ ], "dependencies": ["react-native"], "registryDependencies": [] + }, + { + "name": "textarea", + "type": "registry:component", + "title": "Textarea", + "description": "A textarea component for React Native applications.", + "files": [ + { + "path": "registry/textarea/textarea.tsx", + "type": "registry:component" + } + ], + "dependencies": ["react-native"], + "registryDependencies": [] } ] } diff --git a/registry/textarea/textarea.tsx b/registry/textarea/textarea.tsx new file mode 100644 index 0000000..270c2bb --- /dev/null +++ b/registry/textarea/textarea.tsx @@ -0,0 +1,36 @@ +import * as React from "react"; +import { TextInput, Platform } from "react-native"; +import { cn } from "@/lib/utils"; + +const TextArea = React.forwardRef< + TextInput, + React.ComponentProps +>(({ className, ...props }, ref) => { + const [isFocused, setIsFocused] = React.useState(false); + + return ( + setIsFocused(true)} + onBlur={() => setIsFocused(false)} + {...props} + /> + ); +}); + +TextArea.displayName = "TextArea"; + +export { TextArea };