@momo-kits/foundation 0.89.5 → 0.89.6-rc.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/Application/BottomSheet.tsx +216 -0
- package/Application/BottomTab/BottomTabBar.tsx +278 -0
- package/Application/{BottomTab.tsx → BottomTab/index.tsx} +42 -18
- package/Application/Components.tsx +350 -86
- package/Application/Localize.ts +44 -0
- package/Application/ModalScreen.tsx +14 -185
- package/Application/Navigation.ts +5 -19
- package/Application/NavigationContainer.tsx +62 -72
- package/Application/Navigator.ts +53 -35
- package/Application/StackScreen.tsx +289 -32
- package/Application/index.ts +13 -15
- package/Application/types.ts +64 -35
- package/Application/utils.tsx +76 -30
- package/Assets/icon_bank.json +1 -1
- package/Badge/Badge.tsx +1 -1
- package/Badge/BadgeDotAnimation.tsx +95 -0
- package/Badge/index.tsx +2 -1
- package/Badge/styles.ts +50 -6
- package/Button/index.tsx +44 -26
- package/CheckBox/index.tsx +37 -26
- package/CheckBox/types.ts +5 -3
- package/Consts/colors+spacing+radius.ts +14 -0
- package/Icon/index.tsx +9 -8
- package/Icon/types.ts +2 -2
- package/IconButton/index.tsx +24 -14
- package/Image/index.tsx +23 -8
- package/Image/types.ts +2 -0
- package/Input/Input.tsx +116 -26
- package/Input/InputDropDown.tsx +66 -51
- package/Input/InputMoney.tsx +106 -15
- package/Input/InputOTP.tsx +49 -26
- package/Input/InputSearch.tsx +252 -99
- package/Input/InputTextArea.tsx +26 -6
- package/Input/TextTyping.tsx +113 -0
- package/Input/common.tsx +48 -22
- package/Input/index.tsx +112 -77
- package/Input/styles.ts +48 -11
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +168 -0
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +242 -121
- package/Layout/Section.tsx +4 -3
- package/Layout/styles.ts +11 -13
- package/Layout/types.ts +1 -1
- package/Layout/utils.ts +4 -4
- package/Loader/index.tsx +2 -0
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +56 -45
- package/Popup/PopupPromotion.tsx +5 -7
- package/Popup/types.ts +1 -7
- package/Radio/index.tsx +35 -20
- package/Radio/types.ts +5 -3
- package/Switch/index.tsx +32 -18
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +9 -2
- package/Tag/styles.ts +3 -2
- package/Tag/types.ts +12 -0
- package/Text/index.tsx +24 -5
- package/Text/styles.ts +8 -8
- package/Text/types.ts +19 -1
- package/Title/index.tsx +170 -103
- package/Title/styles.ts +36 -9
- package/Title/types.ts +16 -48
- package/code-scanner.js +125 -16
- package/index.ts +7 -0
- package/migrate_typo.js +56 -0
- package/package.json +11 -10
- package/publish.sh +16 -21
- package/tsconfig.json +1 -1
- package/verify.js +37 -40
package/Layout/Screen.tsx
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {useHeaderHeight} from '@react-navigation/stack';
|
|
2
|
+
import React, {
|
|
3
|
+
forwardRef,
|
|
4
|
+
Fragment,
|
|
5
|
+
ReactNode,
|
|
6
|
+
Ref,
|
|
7
|
+
useContext,
|
|
8
|
+
useEffect,
|
|
9
|
+
useRef,
|
|
10
|
+
} from 'react';
|
|
1
11
|
import {
|
|
2
12
|
Animated,
|
|
3
13
|
KeyboardAvoidingView,
|
|
@@ -8,30 +18,26 @@ import {
|
|
|
8
18
|
View,
|
|
9
19
|
ViewProps,
|
|
10
20
|
} from 'react-native';
|
|
11
|
-
import {useHeaderHeight} from '@react-navigation/stack';
|
|
12
21
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
13
|
-
import React, {
|
|
14
|
-
forwardRef,
|
|
15
|
-
Fragment,
|
|
16
|
-
ReactNode,
|
|
17
|
-
useContext,
|
|
18
|
-
useEffect,
|
|
19
|
-
useRef,
|
|
20
|
-
} from 'react';
|
|
21
|
-
import {Colors, Spacing, Styles} from '../Consts';
|
|
22
|
-
import {Card, Section, validateChildren} from './index';
|
|
23
22
|
import {
|
|
24
23
|
ApplicationContext,
|
|
25
24
|
HeaderBackground,
|
|
26
25
|
HeaderTitle,
|
|
27
26
|
} from '../Application';
|
|
28
27
|
import Navigation from '../Application/Navigation';
|
|
29
|
-
import styles from './styles';
|
|
30
28
|
import {AnimatedHeader, NavigationOptions} from '../Application/types';
|
|
31
|
-
import {
|
|
29
|
+
import {Colors, Spacing, Styles} from '../Consts';
|
|
30
|
+
import {FloatingButton, FloatingButtonProps} from './FloatingButton';
|
|
31
|
+
import {Card, Section, validateChildren} from './index';
|
|
32
|
+
import styles from './styles';
|
|
32
33
|
import {HeaderType} from './types';
|
|
34
|
+
import {InputRef, InputSearchProps} from '../Input';
|
|
35
|
+
import {HeaderExtendHeader} from '../Application/Components';
|
|
33
36
|
|
|
34
37
|
export interface ScreenProps extends ViewProps {
|
|
38
|
+
/**
|
|
39
|
+
* ReactNode representing the content of the screen.
|
|
40
|
+
*/
|
|
35
41
|
children: React.ReactNode;
|
|
36
42
|
/**
|
|
37
43
|
* Optional. Navigation object for handling navigation actions.
|
|
@@ -82,6 +88,28 @@ export interface ScreenProps extends ViewProps {
|
|
|
82
88
|
* Optional. layout card offset overlap header banner.
|
|
83
89
|
*/
|
|
84
90
|
layoutOffset?: -8 | -24 | -56;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Optional. Props for the floating action button.
|
|
94
|
+
*/
|
|
95
|
+
floatingButtonProps?: Omit<FloatingButtonProps, 'animatedValue' | 'bottom'>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Optional. Keyboard vertical offset.
|
|
99
|
+
*/
|
|
100
|
+
keyboardVerticalOffset?: number;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Optional. If `true`, the screen content is using grid layout by span.
|
|
104
|
+
*/
|
|
105
|
+
useGridLayout?: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Optional. specs for input search.
|
|
109
|
+
*/
|
|
110
|
+
inputSearchProps?: InputSearchProps;
|
|
111
|
+
|
|
112
|
+
inputSearchRef?: Ref<InputRef>;
|
|
85
113
|
}
|
|
86
114
|
|
|
87
115
|
const Screen = forwardRef(
|
|
@@ -98,114 +126,173 @@ const Screen = forwardRef(
|
|
|
98
126
|
layoutOffset = -56,
|
|
99
127
|
backgroundColor,
|
|
100
128
|
headerType = 'default',
|
|
129
|
+
floatingButtonProps,
|
|
130
|
+
useGridLayout = true,
|
|
131
|
+
keyboardVerticalOffset,
|
|
132
|
+
inputSearchProps,
|
|
133
|
+
inputSearchRef,
|
|
101
134
|
}: ScreenProps,
|
|
102
|
-
ref
|
|
135
|
+
ref: any
|
|
103
136
|
) => {
|
|
104
|
-
const animatedValue = useRef<Animated.Value | undefined>(undefined);
|
|
105
137
|
const {theme} = useContext(ApplicationContext);
|
|
106
138
|
const insets = useSafeAreaInsets();
|
|
107
139
|
const heightHeader = useHeaderHeight();
|
|
140
|
+
const animatedValue = useRef<Animated.Value>(new Animated.Value(0));
|
|
108
141
|
const currentTint = useRef(Colors.black_01);
|
|
109
|
-
|
|
142
|
+
const isTab = navigation?.instance?.getState?.()?.type === 'tab';
|
|
143
|
+
|
|
110
144
|
let handleScroll;
|
|
111
|
-
let headerBackground: string | undefined = undefined;
|
|
112
145
|
let Component: any = View;
|
|
113
|
-
let
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (headerType == 'extended' || animatedHeader) {
|
|
117
|
-
keyboardVerticalOffset = -20;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (headerType == 'extended') {
|
|
121
|
-
headerBackground = theme.assets?.headerBackground;
|
|
146
|
+
let keyboardOffset = heightHeader - 20;
|
|
147
|
+
if (headerType === 'extended' || animatedHeader || inputSearchProps) {
|
|
148
|
+
keyboardOffset = -20;
|
|
122
149
|
}
|
|
123
150
|
|
|
124
151
|
useEffect(() => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/>
|
|
133
|
-
),
|
|
134
|
-
headerTitle: (props: any) => (
|
|
135
|
-
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
136
|
-
),
|
|
137
|
-
};
|
|
138
|
-
if (animatedHeader.type == 'surface') {
|
|
139
|
-
styleAnimatedHeader = {
|
|
152
|
+
let options: NavigationOptions;
|
|
153
|
+
/**
|
|
154
|
+
* handle for basic header type
|
|
155
|
+
*/
|
|
156
|
+
switch (headerType) {
|
|
157
|
+
case 'none':
|
|
158
|
+
options = {
|
|
140
159
|
headerTransparent: true,
|
|
160
|
+
headerBackground: () => null,
|
|
161
|
+
headerShown: false,
|
|
162
|
+
};
|
|
163
|
+
break;
|
|
164
|
+
|
|
165
|
+
case 'surface':
|
|
166
|
+
options = {
|
|
167
|
+
headerTransparent: false,
|
|
168
|
+
headerShown: true,
|
|
169
|
+
headerTintColor: theme.colors.text.default,
|
|
141
170
|
headerBackground: (props: any) => (
|
|
142
|
-
<HeaderBackground
|
|
143
|
-
{...props}
|
|
144
|
-
image={null}
|
|
145
|
-
backgroundColor={theme.colors.background.surface}
|
|
146
|
-
useBorder={true}
|
|
147
|
-
animatedValue={animatedValue.current}
|
|
148
|
-
/>
|
|
171
|
+
<HeaderBackground {...props} image={null} useSurface={true} />
|
|
149
172
|
),
|
|
173
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
150
174
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
}, [animatedHeader]);
|
|
155
|
-
|
|
156
|
-
useEffect(() => {
|
|
157
|
-
if (!animatedHeader) {
|
|
158
|
-
let headerOptions: NavigationOptions = {};
|
|
159
|
-
switch (headerType) {
|
|
160
|
-
case 'none':
|
|
161
|
-
headerOptions = {
|
|
162
|
-
headerTransparent: true,
|
|
163
|
-
headerBackground: () => null,
|
|
164
|
-
headerShown: false,
|
|
165
|
-
};
|
|
166
|
-
break;
|
|
167
|
-
|
|
168
|
-
case 'surface':
|
|
169
|
-
headerOptions = {
|
|
170
|
-
headerTransparent: false,
|
|
175
|
+
if (inputSearchProps) {
|
|
176
|
+
options = {
|
|
171
177
|
headerShown: true,
|
|
178
|
+
headerTransparent: true,
|
|
172
179
|
headerTintColor: theme.colors.text.default,
|
|
173
|
-
headerBackground: (
|
|
174
|
-
|
|
180
|
+
headerBackground: () => null,
|
|
181
|
+
headerTitle: (props: any) => (
|
|
182
|
+
<HeaderTitle
|
|
175
183
|
{...props}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
interpolate={{
|
|
185
|
+
inputRange: [0, 50],
|
|
186
|
+
outputRange: [1, 0],
|
|
187
|
+
extrapolate: 'clamp',
|
|
188
|
+
}}
|
|
179
189
|
animatedValue={animatedValue.current}
|
|
180
190
|
/>
|
|
181
191
|
),
|
|
182
|
-
headerTitle: (props: any) => (
|
|
183
|
-
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
184
|
-
),
|
|
185
192
|
};
|
|
186
|
-
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
187
195
|
|
|
188
|
-
|
|
189
|
-
|
|
196
|
+
case 'extended':
|
|
197
|
+
options = {
|
|
198
|
+
headerShown: true,
|
|
199
|
+
headerTransparent: true,
|
|
200
|
+
headerTintColor: Colors.black_01,
|
|
201
|
+
headerBackground: () => null,
|
|
202
|
+
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
203
|
+
};
|
|
204
|
+
if (inputSearchProps) {
|
|
205
|
+
options = {
|
|
190
206
|
headerShown: true,
|
|
191
207
|
headerTransparent: true,
|
|
192
208
|
headerTintColor: Colors.black_01,
|
|
193
209
|
headerBackground: () => null,
|
|
194
|
-
headerTitle: (props: any) =>
|
|
210
|
+
headerTitle: (props: any) => (
|
|
211
|
+
<HeaderTitle
|
|
212
|
+
{...props}
|
|
213
|
+
interpolate={{
|
|
214
|
+
inputRange: [0, 50],
|
|
215
|
+
outputRange: [1, 0],
|
|
216
|
+
extrapolate: 'clamp',
|
|
217
|
+
}}
|
|
218
|
+
animatedValue={animatedValue.current}
|
|
219
|
+
/>
|
|
220
|
+
),
|
|
195
221
|
};
|
|
196
|
-
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
197
224
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
225
|
+
default:
|
|
226
|
+
options = {
|
|
227
|
+
headerTransparent: false,
|
|
228
|
+
headerShown: true,
|
|
229
|
+
headerTintColor: Colors.black_01,
|
|
230
|
+
headerBackground: (props: any) => <HeaderBackground {...props} />,
|
|
231
|
+
};
|
|
232
|
+
if (inputSearchProps) {
|
|
233
|
+
options = {
|
|
201
234
|
headerShown: true,
|
|
235
|
+
headerTransparent: true,
|
|
202
236
|
headerTintColor: Colors.black_01,
|
|
203
|
-
headerBackground: (
|
|
237
|
+
headerBackground: () => null,
|
|
238
|
+
headerTitle: (props: any) => (
|
|
239
|
+
<HeaderTitle
|
|
240
|
+
{...props}
|
|
241
|
+
interpolate={{
|
|
242
|
+
inputRange: [0, 50],
|
|
243
|
+
outputRange: [1, 0],
|
|
244
|
+
extrapolate: 'clamp',
|
|
245
|
+
}}
|
|
246
|
+
animatedValue={animatedValue.current}
|
|
247
|
+
/>
|
|
248
|
+
),
|
|
204
249
|
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* override options for animated header
|
|
255
|
+
*/
|
|
256
|
+
if (animatedHeader) {
|
|
257
|
+
options = {
|
|
258
|
+
headerTransparent: true,
|
|
259
|
+
headerBackground: (props: any) => (
|
|
260
|
+
<HeaderBackground
|
|
261
|
+
{...props}
|
|
262
|
+
animatedValue={animatedValue.current}
|
|
263
|
+
/>
|
|
264
|
+
),
|
|
265
|
+
headerTitle: (props: any) => (
|
|
266
|
+
<HeaderTitle {...props} animatedValue={animatedValue.current} />
|
|
267
|
+
),
|
|
268
|
+
};
|
|
269
|
+
if (animatedHeader.type === 'surface') {
|
|
270
|
+
options = {
|
|
271
|
+
...options,
|
|
272
|
+
headerBackground: (props: any) => (
|
|
273
|
+
<HeaderBackground
|
|
274
|
+
{...props}
|
|
275
|
+
image={null}
|
|
276
|
+
useSurface={true}
|
|
277
|
+
animatedValue={animatedValue.current}
|
|
278
|
+
/>
|
|
279
|
+
),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
if (animatedHeader.headerTitle) {
|
|
283
|
+
options = {
|
|
284
|
+
...options,
|
|
285
|
+
headerTitle: (props: any) =>
|
|
286
|
+
animatedHeader.headerTitle?.({
|
|
287
|
+
...props,
|
|
288
|
+
animatedValue: animatedValue.current,
|
|
289
|
+
}),
|
|
290
|
+
};
|
|
205
291
|
}
|
|
206
|
-
navigation?.setOptions(headerOptions);
|
|
207
292
|
}
|
|
208
|
-
|
|
293
|
+
|
|
294
|
+
navigation?.setOptions(options);
|
|
295
|
+
}, [headerType, animatedHeader, inputSearchProps]);
|
|
209
296
|
|
|
210
297
|
/**
|
|
211
298
|
* animated when use scroll && animated value
|
|
@@ -213,8 +300,7 @@ const Screen = forwardRef(
|
|
|
213
300
|
if (scrollable) {
|
|
214
301
|
Component = Animated.ScrollView;
|
|
215
302
|
handleScroll = scrollViewProps?.onScroll;
|
|
216
|
-
if (animatedHeader) {
|
|
217
|
-
animatedValue.current = new Animated.Value(0);
|
|
303
|
+
if (animatedHeader || floatingButtonProps?.icon || inputSearchProps) {
|
|
218
304
|
handleScroll = Animated.event(
|
|
219
305
|
[
|
|
220
306
|
{
|
|
@@ -226,46 +312,67 @@ const Screen = forwardRef(
|
|
|
226
312
|
{
|
|
227
313
|
useNativeDriver: true,
|
|
228
314
|
listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
229
|
-
|
|
315
|
+
scrollViewProps?.onScroll?.(e);
|
|
316
|
+
if (animatedHeader?.type === 'surface') {
|
|
230
317
|
const offsetY = e.nativeEvent.contentOffset.y;
|
|
231
318
|
let color = Colors.black_01;
|
|
232
319
|
if (offsetY > 50) {
|
|
233
320
|
color = theme.colors.text.default;
|
|
234
321
|
}
|
|
235
|
-
if (color
|
|
322
|
+
if (color !== currentTint.current) {
|
|
236
323
|
currentTint.current = color;
|
|
237
324
|
navigation?.setOptions({
|
|
238
325
|
headerTintColor: color,
|
|
239
326
|
});
|
|
240
327
|
}
|
|
241
328
|
}
|
|
242
|
-
scrollViewProps?.onScroll?.(e);
|
|
243
329
|
},
|
|
244
|
-
}
|
|
330
|
+
}
|
|
245
331
|
);
|
|
246
332
|
}
|
|
247
333
|
}
|
|
248
334
|
|
|
335
|
+
/**
|
|
336
|
+
* handle scroll end
|
|
337
|
+
* @param e
|
|
338
|
+
*/
|
|
339
|
+
const handleScrollEnd = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
340
|
+
const offsetY = e.nativeEvent.contentOffset.y;
|
|
341
|
+
if (inputSearchProps && offsetY < 100 && offsetY > 0) {
|
|
342
|
+
Animated.timing(animatedValue.current, {
|
|
343
|
+
toValue: 0,
|
|
344
|
+
useNativeDriver: true,
|
|
345
|
+
duration: 300,
|
|
346
|
+
}).start();
|
|
347
|
+
ref?.scrollTo({y: 0, animated: true});
|
|
348
|
+
}
|
|
349
|
+
scrollViewProps?.onScrollEndDrag?.(e);
|
|
350
|
+
};
|
|
351
|
+
|
|
249
352
|
/**
|
|
250
353
|
* render top navigation banner
|
|
251
354
|
*/
|
|
252
|
-
const
|
|
355
|
+
const renderAnimatedHeader = () => {
|
|
253
356
|
if (typeof animatedHeader?.component === 'function') {
|
|
254
|
-
return
|
|
255
|
-
|
|
256
|
-
|
|
357
|
+
return (
|
|
358
|
+
<View style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
|
|
359
|
+
{animatedHeader?.component({
|
|
360
|
+
animatedValue: animatedValue.current,
|
|
361
|
+
})}
|
|
362
|
+
</View>
|
|
363
|
+
);
|
|
257
364
|
}
|
|
258
365
|
};
|
|
259
366
|
|
|
260
367
|
/**
|
|
261
|
-
* build content for screen
|
|
368
|
+
* build content for screen for grid rule
|
|
262
369
|
*/
|
|
263
370
|
const renderContent = (children: any): any => {
|
|
264
371
|
const results = validateChildren(children, [Section, Card, undefined]);
|
|
265
372
|
if (Array.isArray(results)) {
|
|
266
373
|
return results.map((item, index) => {
|
|
267
374
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
268
|
-
if (item?.type
|
|
375
|
+
if (item?.type === Fragment) {
|
|
269
376
|
return renderContent(item?.props?.children);
|
|
270
377
|
}
|
|
271
378
|
if (item) {
|
|
@@ -275,7 +382,8 @@ const Screen = forwardRef(
|
|
|
275
382
|
style={{
|
|
276
383
|
marginTop: space,
|
|
277
384
|
flex: item.props?.expanded ? 1 : undefined,
|
|
278
|
-
}}
|
|
385
|
+
}}
|
|
386
|
+
onLayout={item.props?.onLayout}>
|
|
279
387
|
{item}
|
|
280
388
|
</View>
|
|
281
389
|
);
|
|
@@ -284,7 +392,7 @@ const Screen = forwardRef(
|
|
|
284
392
|
} else {
|
|
285
393
|
const item: any = children;
|
|
286
394
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
287
|
-
if (item?.type
|
|
395
|
+
if (item?.type === Fragment) {
|
|
288
396
|
return renderContent(item?.props?.children);
|
|
289
397
|
}
|
|
290
398
|
return (
|
|
@@ -293,7 +401,8 @@ const Screen = forwardRef(
|
|
|
293
401
|
style={{
|
|
294
402
|
marginTop: space,
|
|
295
403
|
flex: item?.props?.expanded ? 1 : undefined,
|
|
296
|
-
}}
|
|
404
|
+
}}
|
|
405
|
+
onLayout={item?.props?.onLayout}>
|
|
297
406
|
{children}
|
|
298
407
|
</View>
|
|
299
408
|
);
|
|
@@ -302,42 +411,54 @@ const Screen = forwardRef(
|
|
|
302
411
|
|
|
303
412
|
return (
|
|
304
413
|
<View style={[Styles.flex, {backgroundColor}]}>
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
</>
|
|
315
|
-
)}
|
|
414
|
+
<HeaderExtendHeader
|
|
415
|
+
headerType={headerType}
|
|
416
|
+
heightHeader={heightHeader}
|
|
417
|
+
animatedValue={animatedValue.current}
|
|
418
|
+
inputSearchProps={inputSearchProps}
|
|
419
|
+
navigation={navigation}
|
|
420
|
+
inputSearchRef={inputSearchRef}
|
|
421
|
+
/>
|
|
422
|
+
|
|
316
423
|
<KeyboardAvoidingView
|
|
317
424
|
style={Styles.flex}
|
|
318
425
|
enabled={enableKeyboardAvoidingView}
|
|
319
|
-
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
426
|
+
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
320
427
|
behavior={Platform.select({
|
|
321
428
|
ios: 'padding',
|
|
322
429
|
android: undefined,
|
|
323
430
|
})}>
|
|
324
431
|
{Header}
|
|
432
|
+
|
|
325
433
|
<Component
|
|
326
434
|
{...scrollViewProps}
|
|
327
435
|
ref={ref}
|
|
328
436
|
showsVerticalScrollIndicator={false}
|
|
329
437
|
onScroll={handleScroll}
|
|
438
|
+
onScrollEndDrag={handleScrollEnd}
|
|
439
|
+
scrollEventThrottle={16}
|
|
330
440
|
style={Styles.flex}>
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
</View>
|
|
335
|
-
{renderContent(children)}
|
|
441
|
+
{renderAnimatedHeader()}
|
|
442
|
+
|
|
443
|
+
{useGridLayout ? renderContent(children) : children}
|
|
336
444
|
</Component>
|
|
445
|
+
|
|
446
|
+
{floatingButtonProps && (
|
|
447
|
+
<View>
|
|
448
|
+
<FloatingButton
|
|
449
|
+
{...floatingButtonProps}
|
|
450
|
+
animatedValue={animatedValue.current}
|
|
451
|
+
bottom={
|
|
452
|
+
Footer || isTab ? 12 : Math.min(insets.bottom, 21) + Spacing.S
|
|
453
|
+
}
|
|
454
|
+
/>
|
|
455
|
+
</View>
|
|
456
|
+
)}
|
|
457
|
+
|
|
337
458
|
{Footer && (
|
|
338
459
|
<View
|
|
339
460
|
style={[
|
|
340
|
-
styles.
|
|
461
|
+
styles.shadow,
|
|
341
462
|
{
|
|
342
463
|
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
343
464
|
backgroundColor: theme.colors.background.surface,
|
|
@@ -349,7 +470,7 @@ const Screen = forwardRef(
|
|
|
349
470
|
</KeyboardAvoidingView>
|
|
350
471
|
</View>
|
|
351
472
|
);
|
|
352
|
-
}
|
|
473
|
+
}
|
|
353
474
|
);
|
|
354
475
|
|
|
355
476
|
export default Screen;
|
package/Layout/Section.tsx
CHANGED
|
@@ -85,7 +85,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
85
85
|
{rows.map((i: React.ReactElement, index: number) => {
|
|
86
86
|
return (
|
|
87
87
|
<View key={`Card${cursor}${index}`} style={{flexDirection: 'row'}}>
|
|
88
|
-
{index
|
|
88
|
+
{index !== 0 && (
|
|
89
89
|
<View style={{width: gridContext.gutterSize}}></View>
|
|
90
90
|
)}
|
|
91
91
|
{i}
|
|
@@ -125,14 +125,14 @@ const Section: React.FC<SectionProps> = ({
|
|
|
125
125
|
rows = [item];
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
if (i
|
|
128
|
+
if (i === arrayChild.length - 1) {
|
|
129
129
|
cursor += 1;
|
|
130
130
|
element.push(addRowView(rows, cursor, true));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
134
|
element.push(children);
|
|
135
|
-
if (children?.type
|
|
135
|
+
if (children?.type === Fragment) {
|
|
136
136
|
return renderView(children?.props.children);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -151,6 +151,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
151
151
|
}}>
|
|
152
152
|
<View
|
|
153
153
|
{...props}
|
|
154
|
+
onLayout={undefined}
|
|
154
155
|
style={[
|
|
155
156
|
style,
|
|
156
157
|
styles.protectedStyle,
|
package/Layout/styles.ts
CHANGED
|
@@ -2,12 +2,6 @@ import {Platform, StyleSheet} from 'react-native';
|
|
|
2
2
|
import {Colors, Radius, Spacing} from '../Consts';
|
|
3
3
|
|
|
4
4
|
export default StyleSheet.create({
|
|
5
|
-
extendedHeader: {
|
|
6
|
-
aspectRatio: 1.75,
|
|
7
|
-
position: 'absolute',
|
|
8
|
-
width: '100%',
|
|
9
|
-
height: 210,
|
|
10
|
-
},
|
|
11
5
|
screenBanner: {
|
|
12
6
|
width: '100%',
|
|
13
7
|
},
|
|
@@ -80,17 +74,21 @@ export default StyleSheet.create({
|
|
|
80
74
|
paddingHorizontal: undefined,
|
|
81
75
|
paddingVertical: undefined,
|
|
82
76
|
},
|
|
83
|
-
|
|
77
|
+
shadow: {
|
|
84
78
|
paddingTop: Spacing.S,
|
|
85
79
|
...Platform.select({
|
|
86
|
-
android: {
|
|
87
|
-
elevation: 4,
|
|
88
|
-
},
|
|
89
80
|
ios: {
|
|
81
|
+
shadowColor: Colors.black_17,
|
|
82
|
+
shadowOffset: {
|
|
83
|
+
width: 2,
|
|
84
|
+
height: 2,
|
|
85
|
+
},
|
|
86
|
+
shadowOpacity: 0.25,
|
|
87
|
+
shadowRadius: 10,
|
|
88
|
+
},
|
|
89
|
+
android: {
|
|
90
90
|
shadowColor: Colors.black_20,
|
|
91
|
-
|
|
92
|
-
shadowOpacity: 0.1,
|
|
93
|
-
shadowRadius: 3,
|
|
91
|
+
elevation: 24,
|
|
94
92
|
},
|
|
95
93
|
}),
|
|
96
94
|
},
|
package/Layout/types.ts
CHANGED
package/Layout/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Dimensions} from 'react-native';
|
|
2
1
|
import React, {Fragment, ReactElement, useEffect, useState} from 'react';
|
|
2
|
+
import {Dimensions} from 'react-native';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* validate children type
|
|
@@ -12,7 +12,7 @@ const validateChildren = (
|
|
|
12
12
|
) => {
|
|
13
13
|
const validateType = (child: React.ReactElement) => {
|
|
14
14
|
const valid = childrenTypes.some(
|
|
15
|
-
childrenType => child?.type === childrenType || child?.type
|
|
15
|
+
childrenType => child?.type === childrenType || child?.type === Fragment,
|
|
16
16
|
);
|
|
17
17
|
if (!valid) {
|
|
18
18
|
console.warn(
|
|
@@ -42,7 +42,7 @@ const useGridSystem = () => {
|
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
const subscription: any = Dimensions.addEventListener('change', () => {
|
|
44
44
|
const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
|
|
45
|
-
if (newColumns
|
|
45
|
+
if (newColumns !== numberOfColumns) {
|
|
46
46
|
setNumberOfColumns(newColumns);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -52,4 +52,4 @@ const useGridSystem = () => {
|
|
|
52
52
|
return {numberOfColumns};
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export {
|
|
55
|
+
export {useGridSystem, validateChildren};
|
package/Loader/index.tsx
CHANGED
|
@@ -42,7 +42,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
],
|
|
45
|
-
{useNativeDriver: true}
|
|
45
|
+
{useNativeDriver: true}
|
|
46
46
|
)}
|
|
47
47
|
alwaysBounceHorizontal={false}
|
|
48
48
|
showsHorizontalScrollIndicator={false}
|
|
@@ -80,7 +80,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
80
80
|
return (
|
|
81
81
|
<View style={[style, styles.scrollContainer]}>
|
|
82
82
|
{renderScrollView()}
|
|
83
|
-
{renderIndicator()}
|
|
83
|
+
{scrollContentWidth > scrollViewWidth && renderIndicator()}
|
|
84
84
|
</View>
|
|
85
85
|
);
|
|
86
86
|
};
|
package/Pagination/styles.ts
CHANGED
|
@@ -29,7 +29,6 @@ export default StyleSheet.create({
|
|
|
29
29
|
justifyContent: 'center',
|
|
30
30
|
},
|
|
31
31
|
scrollContainer: {
|
|
32
|
-
alignItems: 'center',
|
|
33
32
|
width: '100%',
|
|
34
33
|
},
|
|
35
34
|
scrollView: {
|
|
@@ -42,6 +41,7 @@ export default StyleSheet.create({
|
|
|
42
41
|
borderRadius: Radius.XS,
|
|
43
42
|
},
|
|
44
43
|
indicatorContainer: {
|
|
44
|
+
alignSelf: 'center',
|
|
45
45
|
width: 72,
|
|
46
46
|
height: 4,
|
|
47
47
|
borderRadius: Radius.XS,
|