@hitesh0009/react-native-basic-form 1.1.2 → 1.1.3
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 +2 -2
- package/dist/types.d.ts +3 -2
- package/package.json +1 -1
- package/src/Form.tsx +5 -7
- package/src/types.ts +16 -3
package/dist/Form.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FlatList, StyleSheet, Text, TextInput, TouchableOpacity, View, } from "react-native";
|
|
2
|
-
export const Form = ({ data, gap_bwt_keyValue = 10, gap_bwt_keys = 12, lable_style, inputtext_style, button_container_style, buttontext_style, placeholderTextColor = "#999",
|
|
2
|
+
export const Form = ({ data, gap_bwt_keyValue = 10, gap_bwt_keys = 12, lable_style, inputtext_style, button_container_style, buttontext_style, placeholderTextColor = "#999", scrollEnabled = true, showsHorizontalScrollIndicator = true, }) => {
|
|
3
3
|
return (<View>
|
|
4
4
|
<FlatList scrollEnabled={scrollEnabled} showsHorizontalScrollIndicator={showsHorizontalScrollIndicator} data={data} keyExtractor={(item) => item.id} ItemSeparatorComponent={() => <View style={{ height: gap_bwt_keys }}/>} renderItem={({ item }) => (<View style={{ gap: gap_bwt_keyValue }}>
|
|
5
5
|
{item.label && (<Text style={[styles.lable, lable_style]}>{item.label}</Text>)}
|
|
6
6
|
|
|
7
|
-
{item.input && (<TextInput style={[styles.inputtext, inputtext_style]} placeholder={item.input.placeholder} placeholderTextColor={placeholderTextColor} multiline={
|
|
7
|
+
{item.input && (<TextInput style={[styles.inputtext, inputtext_style]} placeholder={item.input.placeholder} placeholderTextColor={placeholderTextColor} multiline={item.input.multiline} textAlignVertical={item.input.TextAlignVertical} value={item.input.value} onChangeText={item.input.onChangeText} keyboardType={item.input.keybordType}/>)}
|
|
8
8
|
|
|
9
9
|
{item.button && (<TouchableOpacity onPress={item.button.onPress} style={[styles.button_container, button_container_style]}>
|
|
10
10
|
<Text style={[styles.button_text, buttontext_style]}>
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export type FormInput = {
|
|
|
3
3
|
placeholder?: string;
|
|
4
4
|
value: string;
|
|
5
5
|
onChangeText: (text: string) => void;
|
|
6
|
+
multiline: boolean;
|
|
7
|
+
TextAlignVertical?: "top" | "center" | "bottom" | "auto" | undefined;
|
|
8
|
+
keybordType?: "default" | "number-pad" | "decimal-pad" | "numeric" | "email-address" | "phone-pad" | "url" | "ascii-capable" | "numbers-and-punctuation" | "name-phone-pad" | "twitter" | "web-search" | "visible-password";
|
|
6
9
|
};
|
|
7
10
|
export type FormButton = {
|
|
8
11
|
label: string;
|
|
@@ -25,6 +28,4 @@ export type FormProps = {
|
|
|
25
28
|
placeholderTextColor?: string;
|
|
26
29
|
scrollEnabled?: boolean;
|
|
27
30
|
showsHorizontalScrollIndicator?: boolean;
|
|
28
|
-
multiline_input?: boolean;
|
|
29
|
-
textAlignVertical_input?: "top" | "center" | "bottom" | "auto" | undefined;
|
|
30
31
|
};
|
package/package.json
CHANGED
package/src/Form.tsx
CHANGED
|
@@ -17,11 +17,8 @@ export const Form: React.FC<FormProps> = ({
|
|
|
17
17
|
button_container_style,
|
|
18
18
|
buttontext_style,
|
|
19
19
|
placeholderTextColor = "#999",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
scrollEnabled= true,
|
|
23
|
-
showsHorizontalScrollIndicator= true
|
|
24
|
-
|
|
20
|
+
scrollEnabled = true,
|
|
21
|
+
showsHorizontalScrollIndicator = true,
|
|
25
22
|
}) => {
|
|
26
23
|
return (
|
|
27
24
|
<View>
|
|
@@ -42,10 +39,11 @@ export const Form: React.FC<FormProps> = ({
|
|
|
42
39
|
style={[styles.inputtext, inputtext_style]}
|
|
43
40
|
placeholder={item.input.placeholder}
|
|
44
41
|
placeholderTextColor={placeholderTextColor}
|
|
45
|
-
multiline={
|
|
46
|
-
textAlignVertical={
|
|
42
|
+
multiline={item.input.multiline}
|
|
43
|
+
textAlignVertical={item.input.TextAlignVertical}
|
|
47
44
|
value={item.input.value}
|
|
48
45
|
onChangeText={item.input.onChangeText}
|
|
46
|
+
keyboardType={item.input.keybordType}
|
|
49
47
|
/>
|
|
50
48
|
)}
|
|
51
49
|
|
package/src/types.ts
CHANGED
|
@@ -4,6 +4,22 @@ export type FormInput = {
|
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
value: string;
|
|
6
6
|
onChangeText: (text: string) => void;
|
|
7
|
+
multiline: boolean;
|
|
8
|
+
TextAlignVertical?: "top" | "center" | "bottom" | "auto" | undefined;
|
|
9
|
+
keybordType?:
|
|
10
|
+
| "default"
|
|
11
|
+
| "number-pad"
|
|
12
|
+
| "decimal-pad"
|
|
13
|
+
| "numeric"
|
|
14
|
+
| "email-address"
|
|
15
|
+
| "phone-pad"
|
|
16
|
+
| "url"
|
|
17
|
+
| "ascii-capable"
|
|
18
|
+
| "numbers-and-punctuation"
|
|
19
|
+
| "name-phone-pad"
|
|
20
|
+
| "twitter"
|
|
21
|
+
| "web-search"
|
|
22
|
+
| "visible-password";
|
|
7
23
|
};
|
|
8
24
|
|
|
9
25
|
export type FormButton = {
|
|
@@ -33,7 +49,4 @@ export type FormProps = {
|
|
|
33
49
|
|
|
34
50
|
scrollEnabled?: boolean;
|
|
35
51
|
showsHorizontalScrollIndicator?: boolean;
|
|
36
|
-
|
|
37
|
-
multiline_input?: boolean;
|
|
38
|
-
textAlignVertical_input?: "top" | "center" | "bottom" | "auto" | undefined;
|
|
39
52
|
};
|