@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.
Files changed (71) hide show
  1. package/Application/{BottomTab/index.tsx → BottomTab.tsx} +18 -42
  2. package/Application/Components.tsx +91 -356
  3. package/Application/ModalScreen.tsx +185 -14
  4. package/Application/Navigation.ts +19 -5
  5. package/Application/NavigationContainer.tsx +72 -62
  6. package/Application/Navigator.ts +48 -154
  7. package/Application/StackScreen.tsx +32 -289
  8. package/Application/index.ts +15 -13
  9. package/Application/types.ts +35 -81
  10. package/Application/utils.tsx +30 -76
  11. package/Assets/icon_bank.json +1 -1
  12. package/Badge/Badge.tsx +1 -1
  13. package/Badge/index.tsx +1 -2
  14. package/Badge/styles.ts +6 -50
  15. package/Button/index.tsx +26 -44
  16. package/CheckBox/index.tsx +26 -37
  17. package/CheckBox/types.ts +3 -5
  18. package/Consts/colors+spacing+radius.ts +0 -14
  19. package/Icon/index.tsx +8 -9
  20. package/Icon/types.ts +2 -2
  21. package/IconButton/index.tsx +14 -24
  22. package/Image/index.tsx +8 -23
  23. package/Image/types.ts +0 -2
  24. package/Input/Input.tsx +26 -116
  25. package/Input/InputDropDown.tsx +51 -66
  26. package/Input/InputMoney.tsx +15 -106
  27. package/Input/InputOTP.tsx +26 -49
  28. package/Input/InputSearch.tsx +99 -252
  29. package/Input/InputTextArea.tsx +6 -26
  30. package/Input/common.tsx +22 -48
  31. package/Input/index.tsx +77 -112
  32. package/Input/styles.ts +11 -48
  33. package/Input/utils.ts +1 -1
  34. package/Layout/Card.tsx +3 -4
  35. package/Layout/GridSystem.tsx +1 -1
  36. package/Layout/ItemList.tsx +2 -3
  37. package/Layout/Screen.tsx +121 -242
  38. package/Layout/Section.tsx +3 -4
  39. package/Layout/styles.ts +13 -11
  40. package/Layout/types.ts +1 -1
  41. package/Layout/utils.ts +4 -4
  42. package/Loader/index.tsx +0 -2
  43. package/Pagination/PaginationScroll.tsx +2 -2
  44. package/Pagination/styles.ts +1 -1
  45. package/Popup/PopupNotify.tsx +46 -57
  46. package/Popup/PopupPromotion.tsx +8 -6
  47. package/Popup/types.ts +7 -1
  48. package/Radio/index.tsx +20 -35
  49. package/Radio/types.ts +3 -5
  50. package/Switch/index.tsx +18 -32
  51. package/Switch/types.ts +3 -5
  52. package/Tag/index.tsx +2 -9
  53. package/Tag/styles.ts +2 -3
  54. package/Tag/types.ts +0 -12
  55. package/Text/index.tsx +5 -24
  56. package/Text/styles.ts +8 -8
  57. package/Title/index.tsx +103 -170
  58. package/Title/styles.ts +9 -36
  59. package/Title/types.ts +48 -16
  60. package/code-scanner.js +16 -125
  61. package/index.ts +0 -7
  62. package/package.json +7 -8
  63. package/publish.sh +21 -16
  64. package/tsconfig.json +1 -1
  65. package/Application/BottomSheet.tsx +0 -216
  66. package/Application/BottomTab/BottomTabBar.tsx +0 -278
  67. package/Application/Localize.ts +0 -44
  68. package/Application/constants.ts +0 -9
  69. package/Badge/BadgeDotAnimation.tsx +0 -95
  70. package/Input/TextTyping.tsx +0 -113
  71. 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: any
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
- const isTab = navigation?.instance?.getState?.()?.type === 'tab';
143
-
109
+ let styleAnimatedHeader: NavigationOptions;
144
110
  let handleScroll;
111
+ let headerBackground: string | undefined = undefined;
145
112
  let Component: any = View;
146
- let keyboardOffset = heightHeader - 20;
147
- if (headerType === 'extended' || animatedHeader || inputSearchProps) {
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
- 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 = {
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
- 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 = {
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
- options = {
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 === 'surface') {
270
- options = {
271
- ...options,
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
- useSurface={true}
145
+ backgroundColor={theme.colors.background.surface}
146
+ useBorder={true}
277
147
  animatedValue={animatedValue.current}
278
148
  />
279
149
  ),
280
150
  };
281
151
  }
282
- if (animatedHeader.headerTitle) {
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
- navigation?.setOptions(options);
295
- }, [headerType, animatedHeader, inputSearchProps]);
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 || floatingButtonProps?.icon || inputSearchProps) {
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
- scrollViewProps?.onScroll?.(e);
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 !== currentTint.current) {
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 renderAnimatedHeader = () => {
252
+ const renderHeader = () => {
356
253
  if (typeof animatedHeader?.component === 'function') {
357
- return (
358
- <View style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
359
- {animatedHeader?.component({
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 for grid rule
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 === Fragment) {
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 === Fragment) {
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
- <HeaderExtendHeader
415
- headerType={headerType}
416
- heightHeader={heightHeader}
417
- animatedValue={animatedValue.current}
418
- inputSearchProps={inputSearchProps}
419
- navigation={navigation}
420
- inputSearchRef={inputSearchRef}
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 ?? keyboardOffset}
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
- {renderAnimatedHeader()}
442
-
443
- {useGridLayout ? renderContent(children) : children}
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.shadow,
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;
@@ -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 !== 0 && (
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 === arrayChild.length - 1) {
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 === Fragment) {
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
- shadow: {
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
- elevation: 24,
91
+ shadowOffset: {width: 0, height: -2},
92
+ shadowOpacity: 0.1,
93
+ shadowRadius: 3,
92
94
  },
93
95
  }),
94
96
  },
package/Layout/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type HeaderType = 'default' | 'surface' | 'extended' | 'search' | 'none';
1
+ export type HeaderType = 'default' | 'surface' | 'extended' | 'none';
2
2
 
3
3
  export type GridContextProps = {
4
4
  /**
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 === Fragment,
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 !== numberOfColumns) {
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 {useGridSystem, validateChildren};
55
+ export {validateChildren, useGridSystem};
package/Loader/index.tsx CHANGED
@@ -1,6 +1,4 @@
1
1
  import Loader from './Loader';
2
2
  import ProgressBar from './ProgressBar';
3
- import {LoaderProps, ProgressBarProps} from './types';
4
3
 
5
4
  export {Loader, ProgressBar};
6
- export type {LoaderProps, ProgressBarProps};
@@ -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
- {scrollContentWidth > scrollViewWidth && renderIndicator()}
83
+ {renderIndicator()}
84
84
  </View>
85
85
  );
86
86
  };
@@ -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,