@codeleap/mobile 2.3.16 → 2.3.20

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 (89) hide show
  1. package/dist/components/AutoComplete/index.d.ts +1 -0
  2. package/dist/components/AutoComplete/index.js +2 -1
  3. package/dist/components/AutoComplete/index.js.map +1 -1
  4. package/dist/components/AutoComplete/styles.js +67 -3
  5. package/dist/components/AutoComplete/styles.js.map +1 -1
  6. package/dist/components/Checkbox/index.d.ts +1 -1
  7. package/dist/components/EmptyPlaceholder/index.d.ts +5 -2
  8. package/dist/components/EmptyPlaceholder/index.js +19 -5
  9. package/dist/components/EmptyPlaceholder/index.js.map +1 -1
  10. package/dist/components/EmptyPlaceholder/styles.d.ts +1 -1
  11. package/dist/components/EmptyPlaceholder/styles.js +5 -7
  12. package/dist/components/EmptyPlaceholder/styles.js.map +1 -1
  13. package/dist/components/Grid/styles.d.ts +49 -0
  14. package/dist/components/Image/index.d.ts +1 -0
  15. package/dist/components/Image/index.js +21 -3
  16. package/dist/components/Image/index.js.map +1 -1
  17. package/dist/components/List/styles.d.ts +49 -0
  18. package/dist/components/List/styles.js +5 -4
  19. package/dist/components/List/styles.js.map +1 -1
  20. package/dist/components/Modal/index.d.ts +2 -0
  21. package/dist/components/Modal/index.js +11 -9
  22. package/dist/components/Modal/index.js.map +1 -1
  23. package/dist/components/Modal/styles.d.ts +2 -2
  24. package/dist/components/Modal/styles.js +18 -19
  25. package/dist/components/Modal/styles.js.map +1 -1
  26. package/dist/components/MultiSelect/index.js +7 -5
  27. package/dist/components/MultiSelect/index.js.map +1 -1
  28. package/dist/components/MultiSelect/styles.d.ts +0 -51
  29. package/dist/components/MultiSelect/styles.js +67 -5
  30. package/dist/components/MultiSelect/styles.js.map +1 -1
  31. package/dist/components/MultiSelect/types.d.ts +8 -1
  32. package/dist/components/Scroll/styles.d.ts +49 -0
  33. package/dist/components/Scroll/styles.js +3 -4
  34. package/dist/components/Scroll/styles.js.map +1 -1
  35. package/dist/components/SegmentedControl/index.js +5 -4
  36. package/dist/components/SegmentedControl/index.js.map +1 -1
  37. package/dist/components/SegmentedControl/styles.d.ts +1 -1
  38. package/dist/components/SegmentedControl/styles.js +9 -9
  39. package/dist/components/SegmentedControl/styles.js.map +1 -1
  40. package/dist/components/Select/index.d.ts +4 -1
  41. package/dist/components/Select/index.js +16 -21
  42. package/dist/components/Select/index.js.map +1 -1
  43. package/dist/components/Select/styles.d.ts +54 -53
  44. package/dist/components/Select/styles.js +61 -10
  45. package/dist/components/Select/styles.js.map +1 -1
  46. package/dist/components/Select/types.d.ts +8 -1
  47. package/dist/components/TextInput/index.js +4 -1
  48. package/dist/components/TextInput/index.js.map +1 -1
  49. package/dist/components/Touchable/index.js +5 -1
  50. package/dist/components/Touchable/index.js.map +1 -1
  51. package/dist/components/View/index.js +19 -13
  52. package/dist/components/View/index.js.map +1 -1
  53. package/dist/components/defaultStyles.d.ts +147 -51
  54. package/dist/utils/KeyboardAware/context.js +1 -6
  55. package/dist/utils/KeyboardAware/context.js.map +1 -1
  56. package/dist/utils/PermissionManager/context.js +3 -2
  57. package/dist/utils/PermissionManager/context.js.map +1 -1
  58. package/dist/utils/hooks.d.ts +2 -0
  59. package/dist/utils/hooks.js +44 -1
  60. package/dist/utils/hooks.js.map +1 -1
  61. package/dist/utils/theme.js +3 -3
  62. package/dist/utils/theme.js.map +1 -1
  63. package/package.json +3 -2
  64. package/src/components/AutoComplete/index.tsx +5 -1
  65. package/src/components/AutoComplete/styles.ts +112 -6
  66. package/src/components/Calendar/types.ts +71 -71
  67. package/src/components/EmptyPlaceholder/index.tsx +32 -8
  68. package/src/components/EmptyPlaceholder/styles.ts +18 -15
  69. package/src/components/Image/index.tsx +33 -3
  70. package/src/components/List/styles.ts +7 -1
  71. package/src/components/Modal/index.tsx +12 -7
  72. package/src/components/Modal/styles.ts +36 -46
  73. package/src/components/MultiSelect/index.tsx +10 -4
  74. package/src/components/MultiSelect/styles.ts +117 -4
  75. package/src/components/MultiSelect/types.ts +8 -0
  76. package/src/components/Scroll/styles.ts +4 -1
  77. package/src/components/SegmentedControl/index.tsx +5 -4
  78. package/src/components/SegmentedControl/styles.ts +13 -10
  79. package/src/components/Select/index.tsx +50 -27
  80. package/src/components/Select/styles.ts +103 -25
  81. package/src/components/Select/types.ts +11 -1
  82. package/src/components/TextInput/index.tsx +3 -1
  83. package/src/components/Touchable/index.tsx +5 -3
  84. package/src/components/View/index.tsx +25 -13
  85. package/src/utils/KeyboardAware/context.tsx +2 -7
  86. package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +3 -3
  87. package/src/utils/PermissionManager/context.tsx +1 -1
  88. package/src/utils/hooks.ts +50 -0
  89. package/src/utils/theme.ts +1 -1
@@ -9,22 +9,127 @@ const createAutoCompleteStyle = createDefaultVariantFactory<AutoCompleteComposit
9
9
  export const AutoCompleteStyles = {
10
10
  ...SelectStyles,
11
11
  default: createAutoCompleteStyle((theme) => {
12
- const defaultStyle = SelectStyles.default(theme)
13
12
 
14
13
  return {
15
- ...defaultStyle,
14
+ wrapper: {
15
+ ...theme.presets.absolute,
16
+ // ...theme.presets.whole,
17
+ ...theme.presets.fullHeight,
18
+ ...theme.presets.fullWidth,
19
+ },
20
+ 'box:transition': {
21
+ scale: {
22
+ duration: theme.values.transitions.modal.duration,
23
+ type: 'timing',
24
+ },
25
+ opacity: {
26
+ duration: theme.values.transitions.modal.duration,
27
+ type: 'timing',
28
+ },
29
+ },
30
+ 'backdrop:transition': {
31
+ opacity: {
32
+ duration: theme.values.transitions.modal.duration,
33
+ type: 'timing',
34
+ },
35
+ },
36
+ backdrop: {
37
+ ...theme.presets.absolute,
38
+ ...theme.presets.whole,
39
+
40
+ backgroundColor: theme.colors.black,
41
+
42
+ },
43
+ backdropTouchable: {
44
+ // height: '100%',
45
+ ...theme.presets.absolute,
46
+ ...theme.presets.whole,
47
+
48
+ },
49
+ 'backdrop:visible': {
50
+ opacity: 0.5,
51
+ },
52
+ 'backdrop:hidden': {
53
+ opacity: 0,
54
+ },
55
+ innerWrapper: {
56
+
57
+ },
58
+ scroll: {
59
+ flex: 1,
60
+ // maxHeight: theme.values.height,
61
+ },
62
+ scrollContent: {
63
+ ...theme.presets.alignCenter,
64
+ ...theme.presets.justifyCenter,
65
+ minHeight: '100%',
66
+ ...theme.presets.safeAreaTop(theme.values.innerSpacing.Y),
67
+ ...theme.presets.safeAreaBottom(theme.values.innerSpacing.Y),
68
+ },
69
+ box: {
70
+ backgroundColor: theme.colors.background,
71
+ width: theme.values.width - theme.spacing.value(theme.values.innerSpacing.X * 2),
72
+ borderRadius: theme.borderRadius.modalOuter,
73
+ ...theme.spacing.paddingHorizontal(theme.values.innerSpacing.X),
74
+ ...theme.spacing.paddingVertical(theme.values.innerSpacing.Y),
75
+ },
76
+
77
+ 'box:hidden': {
78
+ opacity: 0,
79
+ scale: 0.8,
80
+
81
+ },
82
+ 'box:visible': {
83
+ opacity: 1,
84
+ scale: 1,
85
+ },
86
+
87
+ closeButtonTouchableWrapper: {
88
+ alignSelf: 'center',
89
+ ...theme.spacing.marginLeft('auto'),
90
+ },
91
+ closeButtonIcon: {
92
+ color: theme.colors.text,
93
+ },
94
+
95
+ listWrapper: {
96
+ height: 'auto',
97
+ },
98
+
99
+ itemWrapper: {
100
+ ...theme.presets.row,
101
+ ...theme.presets.justifySpaceBetween,
102
+ ...theme.presets.alignCenter,
103
+ borderRadius: theme.borderRadius.medium,
104
+ ...theme.spacing.padding(1),
105
+ backgroundColor: theme.colors.backgroundSecondary,
106
+ },
107
+ 'itemWrapper:selected': {
108
+ backgroundColor: theme.colors.primary,
109
+ },
110
+ 'itemIcon:selected': {
111
+ color: theme.colors.backgroundSecondary,
112
+ ...theme.sized(2),
113
+
114
+ },
115
+ 'itemText:selected': {
116
+ color: theme.colors.backgroundSecondary,
117
+
118
+ },
119
+ itemIcon: {
120
+ height: 0,
121
+ width: 0,
122
+ },
16
123
  header: {
17
- ...theme.spacing.paddingHorizontal(2),
18
- ...theme.spacing.paddingTop(1),
124
+ ...theme.spacing.paddingHorizontal(theme.values.innerSpacing.X),
125
+ ...theme.spacing.paddingVertical(theme.values.innerSpacing.Y),
19
126
  ...theme.presets.column,
20
127
  ...theme.presets.alignStart,
21
128
  },
22
-
23
129
  searchInputWrapper: {
24
130
  ...theme.presets.fullWidth,
25
131
  ...theme.spacing.marginTop(2),
26
132
  },
27
-
28
133
  titleWrapper: {
29
134
  ...theme.presets.row,
30
135
  ...theme.presets.alignCenter,
@@ -33,6 +138,7 @@ export const AutoCompleteStyles = {
33
138
  },
34
139
  title: {
35
140
  ...theme.presets.textCenter,
141
+ ...assignTextStyle('h3')(theme).text,
36
142
  flex: 1,
37
143
  },
38
144
  closeButtonWrapper: {
@@ -1,85 +1,85 @@
1
1
  import { FilterKeys } from '@codeleap/common'
2
2
  import { Paths } from '@codeleap/common/dist/types/pathMapping'
3
- import { TextStyle, ViewStyle } from 'react-native';
3
+ import { TextStyle, ViewStyle } from 'react-native'
4
4
 
5
5
  type CalendarTheme = {
6
- timelineContainer?: object;
7
- contentStyle?: ViewStyle;
8
- event?: object;
9
- eventTitle?: object;
10
- eventSummary?: object;
11
- eventTimes?: object;
12
- line?: object;
13
- verticalLine?: object;
14
- nowIndicatorLine?: object;
15
- nowIndicatorKnob?: object;
16
- timeLabel?: object;
17
- todayTextColor?: string;
18
- calendarBackground?: string;
19
- indicatorColor?: string;
20
- textSectionTitleColor?: string;
21
- textSectionTitleDisabledColor?: string;
22
- dayTextColor?: string;
23
- selectedDayTextColor?: string;
24
- monthTextColor?: string;
25
- selectedDayBackgroundColor?: string;
26
- arrowColor?: string;
27
- textDisabledColor?: string;
28
- textInactiveColor?: string;
6
+ timelineContainer?: object
7
+ contentStyle?: ViewStyle
8
+ event?: object
9
+ eventTitle?: object
10
+ eventSummary?: object
11
+ eventTimes?: object
12
+ line?: object
13
+ verticalLine?: object
14
+ nowIndicatorLine?: object
15
+ nowIndicatorKnob?: object
16
+ timeLabel?: object
17
+ todayTextColor?: string
18
+ calendarBackground?: string
19
+ indicatorColor?: string
20
+ textSectionTitleColor?: string
21
+ textSectionTitleDisabledColor?: string
22
+ dayTextColor?: string
23
+ selectedDayTextColor?: string
24
+ monthTextColor?: string
25
+ selectedDayBackgroundColor?: string
26
+ arrowColor?: string
27
+ textDisabledColor?: string
28
+ textInactiveColor?: string
29
29
  backgroundColor?: string; //TODO: remove in V2
30
- dotColor?: string;
31
- selectedDotColor?: string;
32
- disabledArrowColor?: string;
33
- textDayFontFamily?: TextStyle['fontFamily'];
34
- textMonthFontFamily?: TextStyle['fontFamily'];
35
- textDayHeaderFontFamily?: TextStyle['fontFamily'];
36
- textDayFontWeight?: TextStyle['fontWeight'];
37
- textMonthFontWeight?: TextStyle['fontWeight'];
38
- textDayHeaderFontWeight?: TextStyle['fontWeight'];
39
- textDayFontSize?: number;
40
- textMonthFontSize?: number;
41
- textDayHeaderFontSize?: number;
42
- agendaDayTextColor?: string;
43
- agendaDayNumColor?: string;
44
- agendaTodayColor?: string;
45
- agendaKnobColor?: string;
46
- todayButtonFontFamily?: TextStyle['fontFamily'];
47
- todayButtonFontWeight?: TextStyle['fontWeight'];
48
- todayButtonFontSize?: number;
49
- textDayStyle?: TextStyle;
50
- dotStyle?: object;
51
- arrowStyle?: ViewStyle;
52
- todayBackgroundColor?: string;
53
- disabledDotColor?: string;
54
- inactiveDotColor?: string;
55
- todayDotColor?: string;
56
- todayButtonTextColor?: string;
57
- todayButtonPosition?: string;
58
- arrowHeight?: number;
59
- arrowWidth?: number;
60
- weekVerticalMargin?: number;
30
+ dotColor?: string
31
+ selectedDotColor?: string
32
+ disabledArrowColor?: string
33
+ textDayFontFamily?: TextStyle['fontFamily']
34
+ textMonthFontFamily?: TextStyle['fontFamily']
35
+ textDayHeaderFontFamily?: TextStyle['fontFamily']
36
+ textDayFontWeight?: TextStyle['fontWeight']
37
+ textMonthFontWeight?: TextStyle['fontWeight']
38
+ textDayHeaderFontWeight?: TextStyle['fontWeight']
39
+ textDayFontSize?: number
40
+ textMonthFontSize?: number
41
+ textDayHeaderFontSize?: number
42
+ agendaDayTextColor?: string
43
+ agendaDayNumColor?: string
44
+ agendaTodayColor?: string
45
+ agendaKnobColor?: string
46
+ todayButtonFontFamily?: TextStyle['fontFamily']
47
+ todayButtonFontWeight?: TextStyle['fontWeight']
48
+ todayButtonFontSize?: number
49
+ textDayStyle?: TextStyle
50
+ dotStyle?: object
51
+ arrowStyle?: ViewStyle
52
+ todayBackgroundColor?: string
53
+ disabledDotColor?: string
54
+ inactiveDotColor?: string
55
+ todayDotColor?: string
56
+ todayButtonTextColor?: string
57
+ todayButtonPosition?: string
58
+ arrowHeight?: number
59
+ arrowWidth?: number
60
+ weekVerticalMargin?: number
61
61
  stylesheet?: {
62
62
  calendar?: {
63
- main?: object;
64
- header?: object;
65
- };
63
+ main?: object
64
+ header?: object
65
+ }
66
66
  day?: {
67
- basic?: object;
68
- period?: object;
69
- };
70
- dot?: object;
71
- marking?: object;
67
+ basic?: object
68
+ period?: object
69
+ }
70
+ dot?: object
71
+ marking?: object
72
72
  'calendar-list'?: {
73
- main?: object;
74
- };
73
+ main?: object
74
+ }
75
75
  agenda?: {
76
- main?: object;
77
- list?: object;
78
- };
76
+ main?: object
77
+ list?: object
78
+ }
79
79
  expandable?: {
80
- main?: object;
81
- };
82
- };
80
+ main?: object
81
+ }
82
+ }
83
83
  }
84
84
 
85
85
  type FlatStyleKeys = 'dot' | 'marking'
@@ -16,18 +16,25 @@ import {
16
16
  EmptyPlaceholderStyles,
17
17
  } from './styles'
18
18
 
19
- import { StyleSheet } from 'react-native'
19
+ import { ImageSourcePropType, StyleSheet, Image as RNImage } from 'react-native'
20
20
  import { StylesOf } from '../../types'
21
+ import { Image } from '../Image'
21
22
 
22
23
  export * from './styles'
23
24
 
24
25
  export type EmptyPlaceholderProps = {
25
26
  itemName?: string
26
- title?: React.ReactElement
27
+
28
+ title?: React.ReactElement | string
29
+ description?: React.ReactElement | string
30
+ image?: ImageSourcePropType
31
+ icon?: IconPlaceholder
32
+
27
33
  loading?: boolean
34
+
28
35
  styles?: StylesOf<EmptyPlaceholderComposition>
29
36
  variants?: ComponentVariants<typeof EmptyPlaceholderStyles>['variants']
30
- emptyIconName?: IconPlaceholder
37
+
31
38
  renderEmpty?: (props: {
32
39
  emptyText:string | React.ReactElement
33
40
  emptyIconName?: IconPlaceholder
@@ -40,14 +47,16 @@ export const EmptyPlaceholder:React.FC<EmptyPlaceholderProps> = (props: EmptyPla
40
47
  itemName,
41
48
  title,
42
49
  loading,
50
+ description,
51
+ image,
43
52
  styles = {},
44
53
  variants = [],
45
- emptyIconName = 'placeholder',
54
+ icon = null,
46
55
  renderEmpty,
47
56
  } = props
48
57
  const emptyText = title || (itemName && `No ${itemName} found.`) || 'No items.'
49
58
 
50
- const componentStyles = useDefaultComponentStyle('EmptyPlaceholder', {
59
+ const componentStyles = useDefaultComponentStyle<'u:EmptyPlaceholder', typeof EmptyPlaceholderStyles>('u:EmptyPlaceholder', {
51
60
  variants,
52
61
  transform: StyleSheet.flatten,
53
62
  styles,
@@ -69,7 +78,7 @@ export const EmptyPlaceholder:React.FC<EmptyPlaceholderProps> = (props: EmptyPla
69
78
  <View style={componentStyles.wrapper}>
70
79
  {renderEmpty({
71
80
  emptyText,
72
- emptyIconName: emptyIconName as IconPlaceholder,
81
+ emptyIconName: icon as IconPlaceholder,
73
82
  styles: {
74
83
  ...componentStyles,
75
84
  activityIndicatorStyles,
@@ -79,10 +88,25 @@ export const EmptyPlaceholder:React.FC<EmptyPlaceholderProps> = (props: EmptyPla
79
88
  )
80
89
  }
81
90
 
91
+ let _image = null
92
+
93
+ if (icon) {
94
+ _image = <Icon name={icon} style={componentStyles.icon}/>
95
+ } else if (image) {
96
+ _image = <Image source={image} style={[
97
+ componentStyles.image,
98
+
99
+ ]}/>
100
+ }
101
+
82
102
  return (
83
103
  <View style={componentStyles.wrapper}>
84
- <Icon name={emptyIconName as IconPlaceholder} style={componentStyles.icon}/>
85
- <Text text={emptyText} style={componentStyles.text}/>
104
+ <View style={componentStyles.imageWrapper}>
105
+ {_image}
106
+ </View>
107
+
108
+ {React.isValidElement(emptyText) ? emptyText : <Text text={emptyText} style={componentStyles.title}/> }
109
+ {React.isValidElement(description) ? description : <Text text={description} style={componentStyles.description}/> }
86
110
  </View>
87
111
  )
88
112
  }
@@ -5,7 +5,10 @@ export type EmptyPlaceholderComposition =
5
5
  | 'wrapper:loading'
6
6
  | `loader${Capitalize<ActivityIndicatorComposition>}`
7
7
  | 'wrapper'
8
- | 'text'
8
+ | 'title'
9
+ | 'description'
10
+ | 'image'
11
+ | 'imageWrapper'
9
12
  | 'icon'
10
13
 
11
14
  const createEmptyPlaceholderStyle = createDefaultVariantFactory<EmptyPlaceholderComposition>()
@@ -17,24 +20,24 @@ export const EmptyPlaceholderStyles = {
17
20
  ...presets,
18
21
  default: createEmptyPlaceholderStyle((theme) => ({
19
22
  wrapper: {
23
+ flexGrow: 1,
20
24
  ...theme.presets.center,
21
- minHeight: theme.values.window.height / 2,
22
- height: '100%',
23
- flex: 1,
24
25
  },
25
- loaderWrapper: {
26
-
27
- ...theme.spacing.marginVertical(8),
28
- ...theme.presets.center,
29
- ...theme.presets.flex,
30
- },
31
- icon: {
32
- color: theme.colors.placeholder,
33
- size: theme.spacing.value(24),
26
+ title: {
27
+ ...assignTextStyle('h3')(theme).text,
28
+ ...theme.spacing.marginBottom(theme.values.innerSpacing.Y),
34
29
  },
35
- text: {
30
+ description: {
36
31
  ...assignTextStyle('p1')(theme).text,
37
- ...theme.presets.textCenter,
32
+ },
33
+ imageWrapper: {
34
+ ...theme.spacing.paddingBottom(theme.values.innerSpacing.Y * 2),
35
+ ...theme.presets.fullWidth,
36
+ ...theme.presets.alignCenter,
37
+ height: '45%',
38
+ },
39
+ image: {
40
+ ...theme.presets.fullHeight,
38
41
  },
39
42
  })),
40
43
  compact: createEmptyPlaceholderStyle((theme) => ({
@@ -38,10 +38,20 @@ export type ImageProps = Omit<NativeImageProps, 'source' | 'style'> & {
38
38
  | number
39
39
  resizeMode?: keyof typeof FastImage.resizeMode
40
40
  spotlight?: string
41
+ maintainAspectRatioFrom?: 'width' | 'height' | 'none'
41
42
  }
42
43
 
43
44
  export const ImageComponent: React.FC<ImageProps> = (props) => {
44
- const { variants, style, fast = true, spotlight = null, resizeMode = 'contain', source, ...imageProps } = props
45
+ const {
46
+ variants,
47
+ style,
48
+ fast = true,
49
+ spotlight = null,
50
+ resizeMode = 'contain',
51
+ source,
52
+ maintainAspectRatioFrom = 'height',
53
+ ...imageProps
54
+ } = props
45
55
 
46
56
  const variantStyles = useDefaultComponentStyle<'u:Image', typeof ImageStyles>('u:Image', { variants })
47
57
 
@@ -60,12 +70,32 @@ export const ImageComponent: React.FC<ImageProps> = (props) => {
60
70
  style: [variantStyles.touchable],
61
71
  android_ripple: null,
62
72
  }
73
+
74
+ const aspectRatioStyle = React.useMemo(() => {
75
+ if (maintainAspectRatioFrom === 'none' || !imSource) return null
76
+ try {
77
+ // @ts-ignore
78
+ const assetSource = NativeImage.resolveAssetSource(imSource)
79
+ const aspectRatio = assetSource.width / assetSource.height
80
+
81
+ if (Number.isNaN(aspectRatio)) {
82
+ return null
83
+ }
84
+ return {
85
+ aspectRatio,
86
+ }
87
+ } catch (e) {
88
+ return null
89
+ }
90
+
91
+ }, [maintainAspectRatioFrom, imSource])
92
+
63
93
  if (fast) {
64
94
  return (
65
95
  <Wrapper {...wrapperProps}>
66
96
 
67
97
  <FastImage
68
- style={styles}
98
+ style={[aspectRatioStyle, styles]}
69
99
  // @ts-ignore
70
100
  tintColor={styles?.tintColor}
71
101
  source={imSource}
@@ -76,7 +106,7 @@ export const ImageComponent: React.FC<ImageProps> = (props) => {
76
106
  )
77
107
  }
78
108
  return <Wrapper {...wrapperProps}>
79
- <NativeImage style={styles} resizeMode={resizeMode} source={imSource} {...(imageProps as any)} />
109
+ <NativeImage style={[aspectRatioStyle, styles]} resizeMode={resizeMode} source={imSource} {...(imageProps as any)} />
80
110
 
81
111
  </Wrapper>
82
112
  }
@@ -1,11 +1,14 @@
1
- import { createDefaultVariantFactory } from '@codeleap/common'
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
2
  import { ScrollComposition, ScrollStyles } from '../Scroll/styles'
3
3
 
4
4
  export type ListComposition = ScrollComposition | 'separator'
5
5
 
6
6
  const createListStyle = createDefaultVariantFactory<ListComposition>()
7
7
 
8
+ const presets = includePresets(style => createListStyle(() => ({ content: style })))
9
+
8
10
  export const ListStyles = {
11
+ ...presets,
9
12
  default: createListStyle((theme) => {
10
13
  const defaultStyles = ScrollStyles.default(theme)
11
14
  return {
@@ -14,6 +17,9 @@ export const ListStyles = {
14
17
  width: '100%',
15
18
  height: theme.spacing.value(1),
16
19
  },
20
+ content: {
21
+ flexGrow: 1,
22
+ },
17
23
  }
18
24
  }),
19
25
  }
@@ -25,6 +25,7 @@ import { useBackButton, useStaticAnimationStyles } from '../../utils/hooks'
25
25
  import { Text, TextProps } from '../Text'
26
26
  import { Touchable } from '../Touchable'
27
27
  import { GetKeyboardAwarePropsOptions } from '../../utils'
28
+ import { ActionIcon } from '../ActionIcon'
28
29
 
29
30
  export * from './styles'
30
31
 
@@ -43,6 +44,7 @@ export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
43
44
  visible: boolean
44
45
  toggle?: () => void
45
46
  zIndex?: number
47
+ description?: React.ReactElement
46
48
  scroll?: boolean
47
49
  header?: React.ReactElement
48
50
  closeOnHardwareBackPress?: boolean
@@ -57,12 +59,13 @@ export type ModalHeaderProps = Omit<ModalProps, 'styles' | 'renderHeader'> & {
57
59
  title: TextProps['style']
58
60
  closeButton: ButtonProps['styles']
59
61
  }
62
+ description?: React.ReactElement
60
63
  }
61
64
 
62
65
  const DefaultHeader:React.FC<ModalHeaderProps> = (props) => {
63
- const { styles, title = null, showClose = false, closable, debugName, closeIconName = 'close', toggle } = props
66
+ const { styles, title = null, showClose = false, description = null, closable, debugName, closeIconName = 'close', toggle } = props
64
67
  return <>
65
- {(title || showClose) && (
68
+ {(title || showClose || description) && (
66
69
  <View style={styles.wrapper}>
67
70
  {typeof title === 'string' ? (
68
71
  <Text text={title} style={styles.title} />
@@ -71,10 +74,9 @@ const DefaultHeader:React.FC<ModalHeaderProps> = (props) => {
71
74
  )}
72
75
 
73
76
  {(showClose && closable) && (
74
- <Button
77
+ <ActionIcon
75
78
  debugName={`${debugName} modal close button`}
76
79
  icon={closeIconName as IconPlaceholder}
77
- variants={['icon']}
78
80
  onPress={toggle}
79
81
  styles={styles.closeButton}
80
82
  />
@@ -104,7 +106,6 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
104
106
  closeOnHardwareBackPress = true,
105
107
  ...props
106
108
  } = modalProps
107
-
108
109
  const variantStyles = useDefaultComponentStyle('u:Modal', {
109
110
  variants: variants as any,
110
111
  transform: StyleSheet.flatten,
@@ -136,7 +137,9 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
136
137
  const scrollStyle = scroll ? getStyles('scroll') : getStyles('innerWrapper')
137
138
 
138
139
  const headerProps:ModalHeaderProps = {
140
+
139
141
  ...modalProps,
142
+ closable,
140
143
  styles: {
141
144
  wrapper: getStyles('header'),
142
145
  title: getStyles('title'),
@@ -170,14 +173,16 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
170
173
  <ScrollComponent
171
174
  style={scrollStyle}
172
175
  contentContainerStyle={getStyles('scrollContent')}
176
+ showsVerticalScrollIndicator={false}
173
177
  keyboardAware= {{
174
- adapt: 'marginBottom',
178
+ adapt: 'maxHeight',
175
179
  baseStyleProp: 'style',
176
180
  animated: true,
177
181
  enabled: visible,
178
- enableOnAndroid: true,
182
+ // enableOnAndroid: true,
179
183
  }}
180
184
  animated
185
+ // ref={scrollRef}
181
186
  { ...scrollProps}
182
187
  >
183
188
  {dismissOnBackdrop &&