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