@moamc/rn-cli 1.4.0 → 1.4.2
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 +54 -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
|
};
|
|
@@ -128,12 +137,30 @@ const styles = StyleSheet.create({
|
|
|
128
137
|
\t\tcolor: colorConstant.moBlack,
|
|
129
138
|
\t\tmarginVertical: 20,
|
|
130
139
|
\t},
|
|
140
|
+
\theadContainer: {
|
|
141
|
+
\t\tflexDirection: 'row',
|
|
142
|
+
\t\tjustifyContent: 'space-between',
|
|
143
|
+
\t\tmarginTop: 16,
|
|
144
|
+
\t},
|
|
145
|
+
\theadWidth: {
|
|
146
|
+
\t\twidth: '48%',
|
|
147
|
+
\t},
|
|
148
|
+
\tfloatContentStyle: {
|
|
149
|
+
\t\t...fonts.fontWSR16,
|
|
150
|
+
\t\tcolor: colorConstant.amcBlack,
|
|
151
|
+
\t},
|
|
152
|
+
\tfloatStyle: {},
|
|
153
|
+
\tfloatLabelStyle: {
|
|
154
|
+
\t\tcolor: colorConstant?.amcMediumGrey,
|
|
155
|
+
\t\tbackgroundColor: colorConstant?.amcWhite,
|
|
156
|
+
\t\t...fonts.fontWSM12,
|
|
157
|
+
\t\tlineHeight: 16,
|
|
158
|
+
\t},
|
|
131
159
|
});
|
|
132
160
|
|
|
133
161
|
export default ${componentName};
|
|
134
162
|
`;
|
|
135
163
|
} else {
|
|
136
|
-
// Investor app style - original template
|
|
137
164
|
return `import React, { useState } from 'react';
|
|
138
165
|
import { Text, ScrollView, View } from 'react-native';
|
|
139
166
|
import { TouchableRipple } from 'react-native-paper';
|
|
@@ -173,30 +200,7 @@ ${generateFormFields(formFields)}
|
|
|
173
200
|
\t\t\t</Container>
|
|
174
201
|
\t\t\t<Footer style={styles.footerDesign}>
|
|
175
202
|
\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/>\` : ''}
|
|
203
|
+
\t\t\t</Footer>${bottomSheetCode}${datePickerCode}
|
|
200
204
|
\t\t</>
|
|
201
205
|
\t);
|
|
202
206
|
};
|
|
@@ -207,18 +211,15 @@ export default ${componentName};
|
|
|
207
211
|
};
|
|
208
212
|
|
|
209
213
|
const generateScreenTemplate = (screenName, featureName, hasForm = false, formFields = []) => {
|
|
210
|
-
// Use enhanced template for form screens
|
|
211
214
|
if (hasForm) {
|
|
212
215
|
return generateEnhancedTemplate(screenName, featureName, hasForm, formFields);
|
|
213
216
|
}
|
|
214
217
|
|
|
215
|
-
// Simple screen template
|
|
216
218
|
const componentName = screenName;
|
|
217
219
|
const { headerImportPath, hasHeadersFolder } = detectProjectStructure();
|
|
218
220
|
const isDistributorStyle = !hasHeadersFolder;
|
|
219
221
|
|
|
220
222
|
if (isDistributorStyle) {
|
|
221
|
-
// Distributor app style - with Header, Footer, and FormButton
|
|
222
223
|
return `import React from 'react';
|
|
223
224
|
import { View, Text, ScrollView, StyleSheet } from 'react-native';
|
|
224
225
|
import { colorConstant, fonts, utilities } from '../../../assets/styles';
|
|
@@ -270,7 +271,6 @@ const styles = StyleSheet.create({
|
|
|
270
271
|
export default ${componentName};
|
|
271
272
|
`;
|
|
272
273
|
} else {
|
|
273
|
-
// Investor app style - original template
|
|
274
274
|
return `import React from 'react';
|
|
275
275
|
import { View, Text, ScrollView } from 'react-native';
|
|
276
276
|
import { Container, Loader } from '../../../components/common';
|