@towsila/expo-ui-library 1.5.5 → 1.5.7
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import { Text, TouchableOpacity, View } from "react-native";
|
|
2
|
+
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import Input from "./input";
|
|
4
4
|
import { Field } from "../../types/formFields";
|
|
5
5
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
@@ -21,7 +21,24 @@ interface Props {
|
|
|
21
21
|
function splitIntoSteps(fields: Field[]): Field[][] {
|
|
22
22
|
const info = fields.filter((f) => f.type !== "password");
|
|
23
23
|
const security = fields.filter((f) => f.type === "password");
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
const steps: Field[][] = [];
|
|
26
|
+
|
|
27
|
+
// Split info fields if more than 3
|
|
28
|
+
if (info.length > 3) {
|
|
29
|
+
const mid = Math.ceil(info.length / 2);
|
|
30
|
+
steps.push(info.slice(0, mid));
|
|
31
|
+
steps.push(info.slice(mid));
|
|
32
|
+
} else if (info.length > 0) {
|
|
33
|
+
steps.push(info);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Add security fields as separate step
|
|
37
|
+
if (security.length > 0) {
|
|
38
|
+
steps.push(security);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return steps;
|
|
25
42
|
}
|
|
26
43
|
|
|
27
44
|
export const DynamicForm: React.FC<Props> = ({
|
|
@@ -87,7 +104,12 @@ export const DynamicForm: React.FC<Props> = ({
|
|
|
87
104
|
);
|
|
88
105
|
|
|
89
106
|
return (
|
|
90
|
-
<
|
|
107
|
+
<ScrollView
|
|
108
|
+
contentContainerStyle={{ flexGrow: 1 }}
|
|
109
|
+
showsVerticalScrollIndicator={false}
|
|
110
|
+
bounces={false}
|
|
111
|
+
>
|
|
112
|
+
<View style={{ gap: 4, paddingBottom: 20 }}>
|
|
91
113
|
|
|
92
114
|
{/* Stepper — only show if more than 1 step */}
|
|
93
115
|
{totalSteps > 1 && (
|
|
@@ -137,5 +159,6 @@ export const DynamicForm: React.FC<Props> = ({
|
|
|
137
159
|
</View>
|
|
138
160
|
)}
|
|
139
161
|
</View>
|
|
162
|
+
</ScrollView>
|
|
140
163
|
);
|
|
141
164
|
};
|