@hitesh0009/react-native-basic-form 1.2.0 → 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 +12 -4
- package/dist/types.d.ts +16 -2
- package/package.json +1 -1
- package/src/Form.tsx +12 -4
- package/src/types.ts +22 -5
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, inputButtonGroupContainerStyle }) => {
|
|
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}>
|
|
@@ -45,17 +45,25 @@ export const Form = ({ data, gap_bwt_keyValue = 10, gap_bwt_keys = 12, lableStyl
|
|
|
45
45
|
{ flexDirection: "row", gap: 10 },
|
|
46
46
|
inputButtonGroupContainerStyle,
|
|
47
47
|
]}>
|
|
48
|
-
<View style={inputTextContainerStyle}>
|
|
48
|
+
<View style={[inputTextContainerStyle, { gap: gap_bwt_keyValue }]}>
|
|
49
|
+
<Text style={[styles.lable, lableStyle]}>
|
|
50
|
+
{item.inputButtonGroup.input.header}
|
|
51
|
+
</Text>
|
|
52
|
+
|
|
49
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}/>
|
|
50
54
|
</View>
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
<View style={{ gap: gap_bwt_keyValue }}>
|
|
57
|
+
<Text style={[styles.lable, lableStyle]}>
|
|
58
|
+
{item.inputButtonGroup.button.header}
|
|
59
|
+
</Text>
|
|
60
|
+
|
|
53
61
|
<TouchableOpacity onPress={item.inputButtonGroup.button.onPress} style={[styles.button_container, buttonGroupStyle]}>
|
|
54
62
|
<Text style={[styles.button_text, buttonTextStyle]}>
|
|
55
63
|
{item.inputButtonGroup.button.label}
|
|
56
64
|
</Text>
|
|
57
65
|
</TouchableOpacity>
|
|
58
|
-
|
|
66
|
+
</View>
|
|
59
67
|
</View>)}
|
|
60
68
|
</View>)}/>
|
|
61
69
|
</View>);
|
package/dist/types.d.ts
CHANGED
|
@@ -11,9 +11,23 @@ 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
|
+
};
|
|
14
28
|
export type ForminputButtonGroup = {
|
|
15
|
-
input:
|
|
16
|
-
button:
|
|
29
|
+
input: ForminputButtonGroupInput;
|
|
30
|
+
button: ForminputButtonGroupButton;
|
|
17
31
|
};
|
|
18
32
|
export type FormItem = {
|
|
19
33
|
id: string;
|
package/package.json
CHANGED
package/src/Form.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export const Form: React.FC<FormProps> = ({
|
|
|
40
40
|
buttonGroupContainerStyle,
|
|
41
41
|
buttonGroupStyle,
|
|
42
42
|
|
|
43
|
-
inputButtonGroupContainerStyle
|
|
43
|
+
inputButtonGroupContainerStyle,
|
|
44
44
|
}) => {
|
|
45
45
|
return (
|
|
46
46
|
<View style={[{ gap: 20 }, containerStyle]}>
|
|
@@ -142,7 +142,11 @@ export const Form: React.FC<FormProps> = ({
|
|
|
142
142
|
inputButtonGroupContainerStyle,
|
|
143
143
|
]}
|
|
144
144
|
>
|
|
145
|
-
<View style={inputTextContainerStyle}>
|
|
145
|
+
<View style={[inputTextContainerStyle,{gap:gap_bwt_keyValue}]}>
|
|
146
|
+
<Text style={[styles.lable, lableStyle]}>
|
|
147
|
+
{item.inputButtonGroup.input.header}
|
|
148
|
+
</Text>
|
|
149
|
+
|
|
146
150
|
<TextInput
|
|
147
151
|
{...textInputProps}
|
|
148
152
|
style={[styles.inputtext, inputTextStyle]}
|
|
@@ -153,7 +157,11 @@ export const Form: React.FC<FormProps> = ({
|
|
|
153
157
|
/>
|
|
154
158
|
</View>
|
|
155
159
|
|
|
156
|
-
|
|
160
|
+
<View style={{gap:gap_bwt_keyValue}}>
|
|
161
|
+
<Text style={[styles.lable, lableStyle]}>
|
|
162
|
+
{item.inputButtonGroup.button.header}
|
|
163
|
+
</Text>
|
|
164
|
+
|
|
157
165
|
<TouchableOpacity
|
|
158
166
|
onPress={item.inputButtonGroup.button.onPress}
|
|
159
167
|
style={[styles.button_container, buttonGroupStyle]}
|
|
@@ -162,7 +170,7 @@ export const Form: React.FC<FormProps> = ({
|
|
|
162
170
|
{item.inputButtonGroup.button.label}
|
|
163
171
|
</Text>
|
|
164
172
|
</TouchableOpacity>
|
|
165
|
-
|
|
173
|
+
</View>
|
|
166
174
|
</View>
|
|
167
175
|
)}
|
|
168
176
|
</View>
|
package/src/types.ts
CHANGED
|
@@ -24,9 +24,26 @@ export type FormButton = {
|
|
|
24
24
|
label: string;
|
|
25
25
|
onPress: () => void;
|
|
26
26
|
};
|
|
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
|
+
|
|
27
44
|
export type ForminputButtonGroup = {
|
|
28
|
-
input:
|
|
29
|
-
button:
|
|
45
|
+
input: ForminputButtonGroupInput;
|
|
46
|
+
button: ForminputButtonGroupButton;
|
|
30
47
|
};
|
|
31
48
|
|
|
32
49
|
export type FormItem = {
|
|
@@ -36,7 +53,7 @@ export type FormItem = {
|
|
|
36
53
|
button?: FormButton;
|
|
37
54
|
buttonGroup?: FormButton[];
|
|
38
55
|
inputTextGroup?: FormInput[];
|
|
39
|
-
inputButtonGroup?:ForminputButtonGroup
|
|
56
|
+
inputButtonGroup?: ForminputButtonGroup;
|
|
40
57
|
};
|
|
41
58
|
|
|
42
59
|
export type FormProps = {
|
|
@@ -69,6 +86,6 @@ export type FormProps = {
|
|
|
69
86
|
ButtonContainerStyle?: ViewStyle;
|
|
70
87
|
buttonGroupContainerStyle?: ViewStyle;
|
|
71
88
|
buttonGroupStyle?: ViewStyle;
|
|
72
|
-
inputTextGroupContainerStyle?:ViewStyle
|
|
73
|
-
inputButtonGroupContainerStyle?:ViewStyle
|
|
89
|
+
inputTextGroupContainerStyle?: ViewStyle;
|
|
90
|
+
inputButtonGroupContainerStyle?: ViewStyle;
|
|
74
91
|
};
|