@moamc/rn-cli 1.4.0 → 1.4.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/package.json +1 -1
- package/templates/screenTemplate.js +35 -54
package/package.json
CHANGED
|
@@ -53,8 +53,40 @@ const generateEnhancedTemplate = (screenName, featureName, hasForm = false, form
|
|
|
53
53
|
const { headerImportPath, hasHeadersFolder } = detectProjectStructure();
|
|
54
54
|
const isDistributorStyle = !hasHeadersFolder;
|
|
55
55
|
|
|
56
|
+
let bottomSheetCode = '';
|
|
57
|
+
if (hasDropdown) {
|
|
58
|
+
bottomSheetCode = `
|
|
59
|
+
\t\t\t<BottomSheet
|
|
60
|
+
\t\t\t\tmodalVisible={!!openBottomNote}
|
|
61
|
+
\t\t\t\tsetIsModalVisible={() => setOpenBottomNote(null)}
|
|
62
|
+
\t\t\t>
|
|
63
|
+
\t\t\t\t<DropDownReview
|
|
64
|
+
\t\t\t\t\tFundBuyType={/* Add options */[]}
|
|
65
|
+
\t\t\t\t\tselectValue={formData[bottomSheetType]}
|
|
66
|
+
\t\t\t\t\tonSelectValue={e => {
|
|
67
|
+
\t\t\t\t\t\thandleChange(e, bottomSheetType);
|
|
68
|
+
\t\t\t\t\t\tsetOpenBottomNote(null);
|
|
69
|
+
\t\t\t\t\t}}
|
|
70
|
+
\t\t\t\t\tlabel={bottomSheetType}
|
|
71
|
+
\t\t\t\t/>
|
|
72
|
+
\t\t\t</BottomSheet>`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
let datePickerCode = '';
|
|
76
|
+
if (hasDate) {
|
|
77
|
+
datePickerCode = `
|
|
78
|
+
\t\t\t<DatePickerCustom
|
|
79
|
+
\t\t\t\tmodalTransparent={true}
|
|
80
|
+
\t\t\t\tonDateChange={data => {
|
|
81
|
+
\t\t\t\t\thandleChange(moment(data).format('DD MMM YYYY'), 'dateField');
|
|
82
|
+
\t\t\t\t}}
|
|
83
|
+
\t\t\t\tsetModalVisible={() => setOpenCalendar(!openCalendar)}
|
|
84
|
+
\t\t\t\tmodalVisible={openCalendar}
|
|
85
|
+
\t\t\t\tminimumDate={new Date(1920, 0, 1)}
|
|
86
|
+
\t\t\t/>`;
|
|
87
|
+
}
|
|
88
|
+
|
|
56
89
|
if (isDistributorStyle) {
|
|
57
|
-
// Distributor app style with proper imports and styling
|
|
58
90
|
return `import React, { useState } from 'react';
|
|
59
91
|
import { Text, ScrollView, View, StyleSheet } from 'react-native';
|
|
60
92
|
import { colorConstant, fonts, utilities } from '../../../assets/styles';
|
|
@@ -94,30 +126,7 @@ ${generateFormFields(formFields)}
|
|
|
94
126
|
\t\t\t</Container>
|
|
95
127
|
\t\t\t<Footer isBottom={true}>
|
|
96
128
|
\t\t\t\t<FormButton title="Submit" onPress={handleSubmit} />
|
|
97
|
-
\t\t\t</Footer>${
|
|
98
|
-
\t\t\t<BottomSheet
|
|
99
|
-
\t\t\t\tmodalVisible={!!openBottomNote}
|
|
100
|
-
\t\t\t\tsetIsModalVisible={() => setOpenBottomNote(null)}
|
|
101
|
-
\t\t\t>
|
|
102
|
-
\t\t\t\t<DropDownReview
|
|
103
|
-
\t\t\t\t\tFundBuyType={/* Add options */[]}
|
|
104
|
-
\t\t\t\t\tselectValue={formData[bottomSheetType]}
|
|
105
|
-
\t\t\t\t\tonSelectValue={e => {
|
|
106
|
-
\t\t\t\t\t\thandleChange(e, bottomSheetType);
|
|
107
|
-
\t\t\t\t\t\tsetOpenBottomNote(null);
|
|
108
|
-
\t\t\t\t\t}}
|
|
109
|
-
\t\t\t\t\tlabel={bottomSheetType}
|
|
110
|
-
\t\t\t\t/>
|
|
111
|
-
\t\t\t</BottomSheet>\` : ''}${hasDate ? \`
|
|
112
|
-
\t\t\t<DatePickerCustom
|
|
113
|
-
\t\t\t\tmodalTransparent={true}
|
|
114
|
-
\t\t\t\tonDateChange={data => {
|
|
115
|
-
\t\t\t\t\thandleChange(moment(data).format('DD MMM YYYY'), 'dateField');
|
|
116
|
-
\t\t\t\t}}
|
|
117
|
-
\t\t\t\tsetModalVisible={() => setOpenCalendar(!openCalendar)}
|
|
118
|
-
\t\t\t\tmodalVisible={openCalendar}
|
|
119
|
-
\t\t\t\tminimumDate={new Date(1920, 0, 1)}
|
|
120
|
-
\t\t\t/>\` : ''}
|
|
129
|
+
\t\t\t</Footer>${bottomSheetCode}${datePickerCode}
|
|
121
130
|
\t\t</>
|
|
122
131
|
\t);
|
|
123
132
|
};
|
|
@@ -133,7 +142,6 @@ const styles = StyleSheet.create({
|
|
|
133
142
|
export default ${componentName};
|
|
134
143
|
`;
|
|
135
144
|
} else {
|
|
136
|
-
// Investor app style - original template
|
|
137
145
|
return `import React, { useState } from 'react';
|
|
138
146
|
import { Text, ScrollView, View } from 'react-native';
|
|
139
147
|
import { TouchableRipple } from 'react-native-paper';
|
|
@@ -173,30 +181,7 @@ ${generateFormFields(formFields)}
|
|
|
173
181
|
\t\t\t</Container>
|
|
174
182
|
\t\t\t<Footer style={styles.footerDesign}>
|
|
175
183
|
\t\t\t\t<FormButton title="Submit" onPress={handleSubmit} />
|
|
176
|
-
\t\t\t</Footer>${
|
|
177
|
-
\t\t\t<BottomSheet
|
|
178
|
-
\t\t\t\tmodalVisible={!!openBottomNote}
|
|
179
|
-
\t\t\t\tsetIsModalVisible={() => setOpenBottomNote(null)}
|
|
180
|
-
\t\t\t>
|
|
181
|
-
\t\t\t\t<DropDownReview
|
|
182
|
-
\t\t\t\t\tFundBuyType={/* Add options */[]}
|
|
183
|
-
\t\t\t\t\tselectValue={formData[bottomSheetType]}
|
|
184
|
-
\t\t\t\t\tonSelectValue={e => {
|
|
185
|
-
\t\t\t\t\t\thandleChange(e, bottomSheetType);
|
|
186
|
-
\t\t\t\t\t\tsetOpenBottomNote(null);
|
|
187
|
-
\t\t\t\t\t}}
|
|
188
|
-
\t\t\t\t\tlabel={bottomSheetType}
|
|
189
|
-
\t\t\t\t/>
|
|
190
|
-
\t\t\t</BottomSheet>\` : ''}${hasDate ? \`
|
|
191
|
-
\t\t\t<DatePickerCustom
|
|
192
|
-
\t\t\t\tmodalTransparent={true}
|
|
193
|
-
\t\t\t\tonDateChange={data => {
|
|
194
|
-
\t\t\t\t\thandleChange(moment(data).format('DD MMM YYYY'), 'dateField');
|
|
195
|
-
\t\t\t\t}}
|
|
196
|
-
\t\t\t\tsetModalVisible={() => setOpenCalendar(!openCalendar)}
|
|
197
|
-
\t\t\t\tmodalVisible={openCalendar}
|
|
198
|
-
\t\t\t\tminimumDate={new Date(1920, 0, 1)}
|
|
199
|
-
\t\t\t/>\` : ''}
|
|
184
|
+
\t\t\t</Footer>${bottomSheetCode}${datePickerCode}
|
|
200
185
|
\t\t</>
|
|
201
186
|
\t);
|
|
202
187
|
};
|
|
@@ -207,18 +192,15 @@ export default ${componentName};
|
|
|
207
192
|
};
|
|
208
193
|
|
|
209
194
|
const generateScreenTemplate = (screenName, featureName, hasForm = false, formFields = []) => {
|
|
210
|
-
// Use enhanced template for form screens
|
|
211
195
|
if (hasForm) {
|
|
212
196
|
return generateEnhancedTemplate(screenName, featureName, hasForm, formFields);
|
|
213
197
|
}
|
|
214
198
|
|
|
215
|
-
// Simple screen template
|
|
216
199
|
const componentName = screenName;
|
|
217
200
|
const { headerImportPath, hasHeadersFolder } = detectProjectStructure();
|
|
218
201
|
const isDistributorStyle = !hasHeadersFolder;
|
|
219
202
|
|
|
220
203
|
if (isDistributorStyle) {
|
|
221
|
-
// Distributor app style - with Header, Footer, and FormButton
|
|
222
204
|
return `import React from 'react';
|
|
223
205
|
import { View, Text, ScrollView, StyleSheet } from 'react-native';
|
|
224
206
|
import { colorConstant, fonts, utilities } from '../../../assets/styles';
|
|
@@ -270,7 +252,6 @@ const styles = StyleSheet.create({
|
|
|
270
252
|
export default ${componentName};
|
|
271
253
|
`;
|
|
272
254
|
} else {
|
|
273
|
-
// Investor app style - original template
|
|
274
255
|
return `import React from 'react';
|
|
275
256
|
import { View, Text, ScrollView } from 'react-native';
|
|
276
257
|
import { Container, Loader } from '../../../components/common';
|