@hitesh0009/react-native-basic-form 1.1.1 → 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 +3 -3
- package/dist/types.d.ts +6 -3
- package/package.json +1 -1
- package/src/Form.tsx +7 -4
- package/src/types.ts +19 -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
|
-
<FlatList data={data} keyExtractor={(item) => item.id} ItemSeparatorComponent={() => <View style={{ height: gap_bwt_keys }}/>} renderItem={({ item }) => (<View style={{ gap: gap_bwt_keyValue }}>
|
|
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
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { TextStyle, ViewStyle } from
|
|
1
|
+
import type { TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
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;
|
|
@@ -23,6 +26,6 @@ export type FormProps = {
|
|
|
23
26
|
button_container_style?: ViewStyle;
|
|
24
27
|
buttontext_style?: TextStyle;
|
|
25
28
|
placeholderTextColor?: string;
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
scrollEnabled?: boolean;
|
|
30
|
+
showsHorizontalScrollIndicator?: boolean;
|
|
28
31
|
};
|
package/package.json
CHANGED
package/src/Form.tsx
CHANGED
|
@@ -17,12 +17,14 @@ export const Form: React.FC<FormProps> = ({
|
|
|
17
17
|
button_container_style,
|
|
18
18
|
buttontext_style,
|
|
19
19
|
placeholderTextColor = "#999",
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
scrollEnabled = true,
|
|
21
|
+
showsHorizontalScrollIndicator = true,
|
|
22
22
|
}) => {
|
|
23
23
|
return (
|
|
24
24
|
<View>
|
|
25
25
|
<FlatList<FormItem>
|
|
26
|
+
scrollEnabled={scrollEnabled}
|
|
27
|
+
showsHorizontalScrollIndicator={showsHorizontalScrollIndicator}
|
|
26
28
|
data={data}
|
|
27
29
|
keyExtractor={(item) => item.id}
|
|
28
30
|
ItemSeparatorComponent={() => <View style={{ height: gap_bwt_keys }} />}
|
|
@@ -37,10 +39,11 @@ export const Form: React.FC<FormProps> = ({
|
|
|
37
39
|
style={[styles.inputtext, inputtext_style]}
|
|
38
40
|
placeholder={item.input.placeholder}
|
|
39
41
|
placeholderTextColor={placeholderTextColor}
|
|
40
|
-
multiline={
|
|
41
|
-
textAlignVertical={
|
|
42
|
+
multiline={item.input.multiline}
|
|
43
|
+
textAlignVertical={item.input.TextAlignVertical}
|
|
42
44
|
value={item.input.value}
|
|
43
45
|
onChangeText={item.input.onChangeText}
|
|
46
|
+
keyboardType={item.input.keybordType}
|
|
44
47
|
/>
|
|
45
48
|
)}
|
|
46
49
|
|
package/src/types.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
import type { TextStyle, ViewStyle
|
|
1
|
+
import type { TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
|
|
3
3
|
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 = {
|
|
@@ -31,6 +47,6 @@ export type FormProps = {
|
|
|
31
47
|
|
|
32
48
|
placeholderTextColor?: string;
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
scrollEnabled?: boolean;
|
|
51
|
+
showsHorizontalScrollIndicator?: boolean;
|
|
36
52
|
};
|