@hitesh0009/react-native-basic-form 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.MD ADDED
@@ -0,0 +1,26 @@
1
+ # react-native-basic-form
2
+
3
+ A lightweight, data-driven form renderer for React Native with fully controlled inputs and flexible styling.
4
+
5
+ This library helps you render simple forms using a declarative data structure, without managing internal state or enforcing opinions about validation or submission.
6
+
7
+ ---
8
+
9
+ ## ✨ Features
10
+
11
+ - 📦 **JS-only** (no native code, no linking)
12
+ - 🎛 **Fully controlled inputs**
13
+ - 🧩 **Data-driven rendering**
14
+ - 🎨 **Style overrides supported**
15
+ - ⚡ Built on `FlatList` for performance
16
+ - 🧠 Unopinionated and easy to extend
17
+
18
+ ---
19
+
20
+ ## 📦 Installation
21
+
22
+ ```sh
23
+ npm install react-native-basic-form
24
+ or
25
+ yarn add react-native-basic-form
26
+
@@ -0,0 +1,29 @@
1
+ import React, { useState } from "react";
2
+ import { View } from "react-native";
3
+ import { Form } from "react-native-basic-form";
4
+
5
+ export default function App() {
6
+ const [name, setName] = useState("");
7
+
8
+ return (
9
+ <View style={{ padding: 16 }}>
10
+ <Form
11
+ data={[
12
+ {
13
+ id: "name",
14
+ label: "Name",
15
+ input: {
16
+ placeholder: "Enter your name",
17
+ value: name,
18
+ onChangeText: ()=>{},
19
+ },
20
+ button: {
21
+ lable: "name",
22
+ onPress: () => {},
23
+ },
24
+ },
25
+ ]}
26
+ />
27
+ </View>
28
+ );
29
+ }
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import Form from "./src/Form";
2
+
3
+ export const basic_form = Form;
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@hitesh0009/react-native-basic-form",
3
+ "version": "1.0.0",
4
+ "description": "A lightweight, data-driven form renderer for React Native with fully controlled inputs and flexible styling.",
5
+ "keywords": [
6
+ "\"react-native\""
7
+ ],
8
+ "homepage": "https://github.com/hiteshjangir0009/react-native-basic-form#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/hiteshjangir0009/react-native-basic-form/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/hiteshjangir0009/react-native-basic-form.git"
15
+ },
16
+ "license": "ISC",
17
+ "author": "Hitesh Jangir",
18
+ "type": "module",
19
+ "main": "index.js",
20
+ "scripts": {
21
+ "test": "echo \"Error: no test specified\" && exit 1"
22
+ },
23
+ "peerDependencies": {
24
+ "react": "19.1.1",
25
+ "react-native": "0.82.0"
26
+ }
27
+ }
package/src/Form.js ADDED
@@ -0,0 +1,91 @@
1
+ import {
2
+ FlatList,
3
+ StyleSheet,
4
+ Text,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ View,
8
+ } from "react-native";
9
+ import React from "react";
10
+
11
+ const Form = ({
12
+ data = [
13
+ {
14
+ lable: "",
15
+ inputtext: { placeholder: "", value: "", onchangetext: () => {} },
16
+ button: { lable: "", onPress: () => {} },
17
+ },
18
+ ],
19
+ gap_bwt_keyValue,
20
+ gap_bwt_keys,
21
+ lable_style,
22
+ inputtext_style,
23
+ button_container_style,
24
+ buttontext_style,
25
+ placeholderTextColor,
26
+ multiline_input,
27
+ textAlignVertical_input,
28
+ }) => {
29
+ return (
30
+ <View>
31
+ <FlatList
32
+ data={data}
33
+ keyExtractor={(_, index) => index.toString()}
34
+ ItemSeparatorComponent={() => (
35
+ <View style={{ height: gap_bwt_keys || 12 }} />
36
+ )}
37
+ renderItem={({ item, index }) => (
38
+ <View style={{ gap: gap_bwt_keyValue || 10 }}>
39
+ {item.lable && (
40
+ <Text style={[styles.lable, lable_style]}>{item.lable}</Text>
41
+ )}
42
+
43
+ {item.inputtext && (
44
+ <TextInput
45
+ style={[styles.inputtext, inputtext_style]}
46
+ placeholderTextColor={placeholderTextColor || "#999"}
47
+ placeholder={item.inputtext.placeholder}
48
+ multiline={multiline_input || false}
49
+ textAlignVertical={textAlignVertical_input || "center"}
50
+ value={item.inputtext.value}
51
+ onChangeText={(val) => item.inputtext.onchangetext(val)}
52
+ />
53
+ )}
54
+ {item.button && (
55
+ <TouchableOpacity
56
+ onPress={item.button.onPress}
57
+ style={[styles.button_container, button_container_style]}
58
+ >
59
+ <Text style={[styles.button_text, buttontext_style]}>
60
+ {item.button.lable}
61
+ </Text>
62
+ </TouchableOpacity>
63
+ )}
64
+ </View>
65
+ )}
66
+ />
67
+ </View>
68
+ );
69
+ };
70
+
71
+ export default Form;
72
+
73
+ const styles = StyleSheet.create({
74
+ lable: {
75
+ color: "#000",
76
+ fontSize: 14,
77
+ },
78
+ inputtext: {
79
+ color: "#000",
80
+ fontSize: 12,
81
+ borderWidth: 1,
82
+ borderColor: "#b1b0b0",
83
+ borderRadius: 10,
84
+ padding: 10,
85
+ },
86
+ button_container: {},
87
+ button_text: {
88
+ color: "#000",
89
+ fontSize: 14,
90
+ },
91
+ });