@hitesh0009/react-native-basic-form 1.1.11 → 1.2.1

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/dist/Form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FlatList, Image, StyleSheet, Text, TextInput, TouchableOpacity, View, } from "react-native";
2
- export const Form = ({ data, gap_bwt_keyValue = 10, gap_bwt_keys = 12, lableStyle, inputTextStyle, buttonContainerStyle, buttonTextStyle, headerIcon, headerIconStyle, headerTextStyle, imageProps, flatlistProps, textInputProps, textProp, headerText, headerContainerStyle, containerStyle, imageContainerStyle, touchableOpacityProp, inputTextContainerStyle, inputTextGroupContainerStyle, ButtonContainerStyle, buttonGroupContainerStyle, buttonGroupStyle, }) => {
2
+ export const Form = ({ data, gap_bwt_keyValue = 10, gap_bwt_keys = 12, lableStyle, inputTextStyle, buttonContainerStyle, buttonTextStyle, headerIcon, headerIconStyle, headerTextStyle, imageProps, flatlistProps, textInputProps, textProp, headerText, headerContainerStyle, containerStyle, imageContainerStyle, touchableOpacityProp, inputTextContainerStyle, inputTextGroupContainerStyle, ButtonContainerStyle, buttonGroupContainerStyle, buttonGroupStyle, inputButtonGroupContainerStyle, }) => {
3
3
  return (<View style={[{ gap: 20 }, containerStyle]}>
4
4
  {(headerIcon || headerText) && (<View style={[{ flexDirection: "row", gap: 10 }, headerContainerStyle]}>
5
5
  {headerIcon && (<View style={imageContainerStyle}>
@@ -40,6 +40,31 @@ export const Form = ({ data, gap_bwt_keyValue = 10, gap_bwt_keys = 12, lableStyl
40
40
  </Text>
41
41
  </TouchableOpacity>))}
42
42
  </View>)}
43
+
44
+ {item.inputButtonGroup && (<View style={[
45
+ { flexDirection: "row", gap: 10 },
46
+ inputButtonGroupContainerStyle,
47
+ ]}>
48
+ <View style={[inputTextContainerStyle, { gap: gap_bwt_keyValue }]}>
49
+ <Text style={[styles.lable, lableStyle]}>
50
+ {item.inputButtonGroup.input.header}
51
+ </Text>
52
+
53
+ <TextInput {...textInputProps} style={[styles.inputtext, inputTextStyle]} placeholder={item.inputButtonGroup.input.placeholder} value={item.inputButtonGroup.input.value} onChangeText={item.inputButtonGroup.input.onChangeText} keyboardType={item.inputButtonGroup.input.keyboardType}/>
54
+ </View>
55
+
56
+ <View style={{ gap: gap_bwt_keyValue }}>
57
+ <Text style={[styles.lable, lableStyle]}>
58
+ {item.inputButtonGroup.button.header}
59
+ </Text>
60
+
61
+ <TouchableOpacity onPress={item.inputButtonGroup.button.onPress} style={[styles.button_container, buttonGroupStyle]}>
62
+ <Text style={[styles.button_text, buttonTextStyle]}>
63
+ {item.inputButtonGroup.button.label}
64
+ </Text>
65
+ </TouchableOpacity>
66
+ </View>
67
+ </View>)}
43
68
  </View>)}/>
44
69
  </View>);
45
70
  };
package/dist/types.d.ts CHANGED
@@ -11,6 +11,24 @@ export type FormButton = {
11
11
  label: string;
12
12
  onPress: () => void;
13
13
  };
14
+ export type ForminputButtonGroupInput = {
15
+ header: string;
16
+ placeholder?: string;
17
+ value: string;
18
+ onChangeText: TextInputProps["onChangeText"];
19
+ multiline?: TextInputProps["multiline"];
20
+ textAlignVertical?: TextInputProps["textAlignVertical"];
21
+ keyboardType?: TextInputProps["keyboardType"];
22
+ };
23
+ export type ForminputButtonGroupButton = {
24
+ header: string;
25
+ label: string;
26
+ onPress: () => void;
27
+ };
28
+ export type ForminputButtonGroup = {
29
+ input: ForminputButtonGroupInput;
30
+ button: ForminputButtonGroupButton;
31
+ };
14
32
  export type FormItem = {
15
33
  id: string;
16
34
  label?: string;
@@ -18,6 +36,7 @@ export type FormItem = {
18
36
  button?: FormButton;
19
37
  buttonGroup?: FormButton[];
20
38
  inputTextGroup?: FormInput[];
39
+ inputButtonGroup?: ForminputButtonGroup;
21
40
  };
22
41
  export type FormProps = {
23
42
  data: FormItem[];
@@ -45,4 +64,5 @@ export type FormProps = {
45
64
  buttonGroupContainerStyle?: ViewStyle;
46
65
  buttonGroupStyle?: ViewStyle;
47
66
  inputTextGroupContainerStyle?: ViewStyle;
67
+ inputButtonGroupContainerStyle?: ViewStyle;
48
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitesh0009/react-native-basic-form",
3
- "version": "1.1.11",
3
+ "version": "1.2.1",
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
@@ -39,6 +39,8 @@ export const Form: React.FC<FormProps> = ({
39
39
 
40
40
  buttonGroupContainerStyle,
41
41
  buttonGroupStyle,
42
+
43
+ inputButtonGroupContainerStyle,
42
44
  }) => {
43
45
  return (
44
46
  <View style={[{ gap: 20 }, containerStyle]}>
@@ -132,6 +134,45 @@ export const Form: React.FC<FormProps> = ({
132
134
  ))}
133
135
  </View>
134
136
  )}
137
+
138
+ {item.inputButtonGroup && (
139
+ <View
140
+ style={[
141
+ { flexDirection: "row", gap: 10 },
142
+ inputButtonGroupContainerStyle,
143
+ ]}
144
+ >
145
+ <View style={[inputTextContainerStyle,{gap:gap_bwt_keyValue}]}>
146
+ <Text style={[styles.lable, lableStyle]}>
147
+ {item.inputButtonGroup.input.header}
148
+ </Text>
149
+
150
+ <TextInput
151
+ {...textInputProps}
152
+ style={[styles.inputtext, inputTextStyle]}
153
+ placeholder={item.inputButtonGroup.input.placeholder}
154
+ value={item.inputButtonGroup.input.value}
155
+ onChangeText={item.inputButtonGroup.input.onChangeText}
156
+ keyboardType={item.inputButtonGroup.input.keyboardType}
157
+ />
158
+ </View>
159
+
160
+ <View style={{gap:gap_bwt_keyValue}}>
161
+ <Text style={[styles.lable, lableStyle]}>
162
+ {item.inputButtonGroup.button.header}
163
+ </Text>
164
+
165
+ <TouchableOpacity
166
+ onPress={item.inputButtonGroup.button.onPress}
167
+ style={[styles.button_container, buttonGroupStyle]}
168
+ >
169
+ <Text style={[styles.button_text, buttonTextStyle]}>
170
+ {item.inputButtonGroup.button.label}
171
+ </Text>
172
+ </TouchableOpacity>
173
+ </View>
174
+ </View>
175
+ )}
135
176
  </View>
136
177
  )}
137
178
  />
package/src/types.ts CHANGED
@@ -25,6 +25,27 @@ export type FormButton = {
25
25
  onPress: () => void;
26
26
  };
27
27
 
28
+ export type ForminputButtonGroupInput = {
29
+ header: string;
30
+ placeholder?: string;
31
+ value: string;
32
+ onChangeText: TextInputProps["onChangeText"];
33
+ multiline?: TextInputProps["multiline"];
34
+ textAlignVertical?: TextInputProps["textAlignVertical"];
35
+ keyboardType?: TextInputProps["keyboardType"];
36
+ };
37
+
38
+ export type ForminputButtonGroupButton = {
39
+ header: string;
40
+ label: string;
41
+ onPress: () => void;
42
+ };
43
+
44
+ export type ForminputButtonGroup = {
45
+ input: ForminputButtonGroupInput;
46
+ button: ForminputButtonGroupButton;
47
+ };
48
+
28
49
  export type FormItem = {
29
50
  id: string;
30
51
  label?: string;
@@ -32,6 +53,7 @@ export type FormItem = {
32
53
  button?: FormButton;
33
54
  buttonGroup?: FormButton[];
34
55
  inputTextGroup?: FormInput[];
56
+ inputButtonGroup?: ForminputButtonGroup;
35
57
  };
36
58
 
37
59
  export type FormProps = {
@@ -64,5 +86,6 @@ export type FormProps = {
64
86
  ButtonContainerStyle?: ViewStyle;
65
87
  buttonGroupContainerStyle?: ViewStyle;
66
88
  buttonGroupStyle?: ViewStyle;
67
- inputTextGroupContainerStyle?:ViewStyle
89
+ inputTextGroupContainerStyle?: ViewStyle;
90
+ inputButtonGroupContainerStyle?: ViewStyle;
68
91
  };