@hitesh0009/react-native-basic-form 1.3.3 → 1.3.5

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 CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # 🚀 React Native Basic Form
3
2
 
4
3
  ### Control your entire form using JSON — not JSX.
@@ -57,7 +56,7 @@ A **schema-driven, fully customizable form renderer for React Native**.
57
56
 
58
57
  - 🧩 **Schema-based rendering**
59
58
  - 📐 **Row / Column layouts**
60
- - 🎨 **Fully customizable styles**
59
+ - 🎨 **Field-level & block-level styling**
61
60
  - 🧠 **No internal state** (you control values & handlers)
62
61
  - 🌍 **Language-agnostic** (i18n handled by user)
63
62
  - 🛡 **Type-safe** with TypeScript
@@ -96,6 +95,7 @@ const formSchema = [
96
95
  {
97
96
  layout: 'column',
98
97
  spacing: 20,
98
+ style: { padding: 16 }, // 👈 block-level styling
99
99
  children: [
100
100
  {
101
101
  type: 'input',
@@ -157,12 +157,13 @@ The form renderer handles **how** it is rendered.
157
157
 
158
158
  ### 2. Layout Blocks
159
159
 
160
- Each schema block controls layout only.
160
+ Each schema block controls layout and grouping.
161
161
 
162
162
  ```ts
163
163
  {
164
164
  layout: 'row',
165
165
  spacing: 12,
166
+ style: { alignItems: 'center' },
166
167
  children: [...]
167
168
  }
168
169
  ```
@@ -194,6 +195,7 @@ Supported field types:
194
195
  type: 'input',
195
196
  label: 'Age',
196
197
  spacing: 8,
198
+ style: { borderColor: '#16a34a' },
197
199
  inputProps: {
198
200
  placeholder: 'Enter age',
199
201
  keyboardType: 'numeric',
@@ -222,7 +224,7 @@ All standard **React Native `TextInputProps`** are supported via `inputProps`.
222
224
  }
223
225
  ```
224
226
 
225
- All standard **`TouchableOpacity` behavior** is supported via `buttonProps`.
227
+ All standard **`TouchableOpacity` props** are supported via `buttonProps`.
226
228
 
227
229
  ---
228
230
 
@@ -232,19 +234,20 @@ Styling is **fully user-controlled**.
232
234
 
233
235
  ### Field-level props
234
236
 
235
- | Prop | Description |
236
- | ------------ | ---------------------------------------- |
237
- | `style` | Container style |
238
- | `textStyle` | Button text style |
239
- | `labelStyle` | Label text style |
240
- | `spacing` | Vertical spacing between label and field |
237
+ | Prop | Description |
238
+ | ------------ | ----------------------------- |
239
+ | `style` | Field container style |
240
+ | `textStyle` | Button text style |
241
+ | `labelStyle` | Label text style |
242
+ | `spacing` | Space between label and field |
241
243
 
242
244
  ### Block-level props
243
245
 
244
- | Prop | Description |
245
- | --------- | -------------------- |
246
- | `layout` | `row` or `column` |
247
- | `spacing` | Space between fields |
246
+ | Prop | Description |
247
+ | --------- | ---------------------------------- |
248
+ | `layout` | `row` or `column` |
249
+ | `spacing` | Space between fields |
250
+ | `style` | Wrapper `View` style for the block |
248
251
 
249
252
  ---
250
253
 
@@ -266,20 +269,13 @@ No translation logic is included.
266
269
 
267
270
  The library exposes a **strict schema contract**.
268
271
 
269
- ### Types Overview
270
-
271
272
  ```ts
272
- export type FormField = FormInput | FormButton;
273
-
274
273
  export type FormItem = {
275
274
  layout?: 'row' | 'column';
276
275
  spacing?: number;
276
+ style?: ViewStyle;
277
277
  children: FormField[];
278
278
  };
279
-
280
- export type FormProps = {
281
- schema: FormItem[];
282
- };
283
279
  ```
284
280
 
285
281
  TypeScript will:
@@ -349,4 +345,3 @@ Please keep PRs:
349
345
  ## 📄 License
350
346
 
351
347
  MIT
352
-
package/dist/Form.js CHANGED
@@ -14,10 +14,10 @@ export const Form = ({ schema = [] }) => {
14
14
  }
15
15
  };
16
16
  return (<>
17
- {schema.map((block, blockIndex) => (<View key={blockIndex} style={{
18
- flexDirection: block.layout || "column",
19
- gap: block.spacing || 20,
20
- }}>
17
+ {schema.map((block, blockIndex) => (<View key={blockIndex} style={[{
18
+ flexDirection: block.layout || "column",
19
+ gap: block.spacing || 20,
20
+ }, block.style]}>
21
21
  {block.children.map(RenderField)}
22
22
  </View>))}
23
23
  </>);
package/dist/types.d.ts CHANGED
@@ -21,6 +21,7 @@ export type FormField = FormInput | FormButton;
21
21
  export type FormItem = {
22
22
  layout?: ViewStyle['flexDirection'];
23
23
  spacing?: number;
24
+ style?: ViewStyle;
24
25
  children: FormField[];
25
26
  };
26
27
  export type FormProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitesh0009/react-native-basic-form",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "A lightweight, data-driven form renderer for React Native with fully controlled inputs and flexible styling.",
5
5
  "keywords": [
6
6
  "react-native",
package/src/Form.tsx CHANGED
@@ -42,10 +42,10 @@ export const Form: React.FC<FormProps> = ({ schema = [] }) => {
42
42
  {schema.map((block, blockIndex) => (
43
43
  <View
44
44
  key={blockIndex}
45
- style={{
45
+ style={[{
46
46
  flexDirection: block.layout || "column",
47
47
  gap: block.spacing || 20,
48
- }}
48
+ },block.style]}
49
49
  >
50
50
  {block.children.map(RenderField)}
51
51
  </View>
package/src/types.ts CHANGED
@@ -33,6 +33,7 @@ export type FormField = FormInput | FormButton;
33
33
  export type FormItem = {
34
34
  layout?: ViewStyle['flexDirection'];
35
35
  spacing?: number;
36
+ style?:ViewStyle
36
37
  children: FormField[];
37
38
  };
38
39