react-native-molecules 0.5.0-beta.21 → 0.5.0-beta.23

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 (59) hide show
  1. package/components/Button/Button.tsx +3 -1
  2. package/components/Card/Card.tsx +1 -1
  3. package/components/Checkbox/CheckboxBase.ios.tsx +1 -4
  4. package/components/Checkbox/CheckboxBase.tsx +2 -7
  5. package/components/DatePicker/DateCalendar.tsx +4 -4
  6. package/components/DatePicker/DatePickerModal.tsx +2 -1
  7. package/components/DatePicker/utils.ts +2 -0
  8. package/components/DatePickerInline/DatePickerDockedHeader.tsx +3 -3
  9. package/components/DatePickerInline/DatePickerInline.tsx +1 -1
  10. package/components/DatePickerInline/DatePickerInlineBase.tsx +2 -2
  11. package/components/DatePickerInline/DatePickerInlineHeader.tsx +43 -17
  12. package/components/DatePickerInline/HeaderItem.tsx +2 -2
  13. package/components/DatePickerInline/MonthPicker.tsx +58 -64
  14. package/components/DatePickerInline/Swiper.native.tsx +2 -2
  15. package/components/DatePickerInline/Swiper.tsx +3 -3
  16. package/components/DatePickerInline/YearPicker.tsx +108 -119
  17. package/components/DatePickerInline/{DatePickerContext.tsx → store.tsx} +7 -3
  18. package/components/DatePickerInline/types.ts +1 -1
  19. package/components/Divider/Divider.tsx +192 -0
  20. package/components/Divider/index.tsx +11 -0
  21. package/components/Drawer/DrawerItemGroup.tsx +3 -7
  22. package/components/IconButton/IconButton.tsx +2 -12
  23. package/components/List/List.tsx +275 -0
  24. package/components/List/context.tsx +26 -0
  25. package/components/List/index.ts +8 -0
  26. package/components/List/types.ts +117 -0
  27. package/components/List/utils.ts +79 -0
  28. package/components/Menu/Menu.tsx +146 -19
  29. package/components/Menu/index.tsx +9 -7
  30. package/components/Menu/utils.ts +21 -70
  31. package/components/Popover/Popover.tsx +7 -10
  32. package/components/Popover/PopoverRoot.tsx +6 -20
  33. package/components/Popover/common.ts +4 -0
  34. package/components/Popover/index.ts +2 -8
  35. package/components/Popover/usePlatformMeasure.ts +4 -2
  36. package/components/RadioButton/RadioButtonAndroid.tsx +38 -54
  37. package/components/RadioButton/RadioButtonIOS.tsx +2 -16
  38. package/components/Select/Select.tsx +307 -501
  39. package/components/Select/context.tsx +39 -32
  40. package/components/Select/types.ts +63 -56
  41. package/components/Select/utils.ts +19 -44
  42. package/components/Text/textFactory.tsx +17 -5
  43. package/components/TimePicker/TimeInput.tsx +2 -7
  44. package/components/TimePicker/utils.ts +0 -4
  45. package/components/TouchableRipple/TouchableRipple.native.tsx +36 -5
  46. package/components/TouchableRipple/TouchableRipple.tsx +121 -163
  47. package/components/TouchableRipple/rippleFromForegroundColor.ts +21 -0
  48. package/package.json +6 -3
  49. package/components/HorizontalDivider/HorizontalDivider.tsx +0 -103
  50. package/components/HorizontalDivider/index.tsx +0 -9
  51. package/components/ListItem/ListItem.tsx +0 -138
  52. package/components/ListItem/ListItemDescription.tsx +0 -25
  53. package/components/ListItem/ListItemTitle.tsx +0 -25
  54. package/components/ListItem/index.tsx +0 -14
  55. package/components/ListItem/utils.ts +0 -115
  56. package/components/Menu/MenuDivider.tsx +0 -13
  57. package/components/Menu/MenuItem.tsx +0 -128
  58. package/components/VerticalDivider/VerticalDivider.tsx +0 -100
  59. package/components/VerticalDivider/index.tsx +0 -9
@@ -1,16 +1,18 @@
1
1
  import { setYear } from 'date-fns';
2
2
  import { memo, useCallback, useLayoutEffect, useMemo, useRef } from 'react';
3
- import { FlatList, ScrollView, StyleSheet, View } from 'react-native';
3
+ import { FlatList, StyleSheet, View } from 'react-native';
4
4
 
5
5
  import { getYearRange, resolveStateVariant } from '../../utils';
6
6
  import { datePickerMonthItemStyles, datePickerMonthPickerStyles } from '../DatePicker/utils';
7
- import { HorizontalDivider } from '../HorizontalDivider';
7
+ import { Divider } from '../Divider';
8
8
  import { Icon } from '../Icon';
9
- import { ListItem } from '../ListItem';
9
+ import { List, type ListItemId, useListContextValue } from '../List';
10
10
  import { Text } from '../Text';
11
- import { useDatePickerStore } from './DatePickerContext';
11
+ import { useDatePickerInlineStore } from './store';
12
12
  import { datePickerYearItemStyles, datePickerYearPickerStyles } from './utils';
13
13
 
14
+ type YearListItem = { id: number; label: string };
15
+
14
16
  const GRID_ITEM_HEIGHT = 62;
15
17
  const NUM_COLUMNS = 3;
16
18
  const LIST_ITEM_HEIGHT = 46;
@@ -25,23 +27,19 @@ export default function YearPicker({ layout = 'grid' }: YearPickerProps) {
25
27
  }
26
28
 
27
29
  function YearPickerGrid() {
28
- const [{ startDateYear, endDateYear, localDate, pickerType }, setStore] = useDatePickerStore(
29
- state => state,
30
- );
30
+ const [{ startDateYear, endDateYear, localDate, pickerType }, setStore] =
31
+ useDatePickerInlineStore(state => state);
31
32
  const years = useMemo(
32
33
  () => getYearRange(startDateYear, endDateYear),
33
34
  [startDateYear, endDateYear],
34
35
  );
35
- const rows = useMemo(() => {
36
- const chunks: number[][] = [];
37
- for (let i = 0; i < years.length; i += NUM_COLUMNS) {
38
- chunks.push(years.slice(i, i + NUM_COLUMNS));
39
- }
40
- return chunks;
41
- }, [years]);
36
+ const yearItems = useMemo(
37
+ () => years.map(year => ({ id: year, label: String(year) })),
38
+ [years],
39
+ );
42
40
  const selectingYear = pickerType === 'year';
43
41
  const selectedYear = localDate.getFullYear();
44
- const scrollRef = useRef<ScrollView | null>(null);
42
+ const flatListRef = useRef<FlatList<YearListItem> | null>(null);
45
43
 
46
44
  const initialScrollOffset = useMemo(() => {
47
45
  if (years.length === 0) return 0;
@@ -53,7 +51,7 @@ function YearPickerGrid() {
53
51
 
54
52
  useLayoutEffect(() => {
55
53
  if (!selectingYear) return;
56
- scrollRef.current?.scrollTo({ y: initialScrollOffset, animated: false });
54
+ flatListRef.current?.scrollToOffset({ offset: initialScrollOffset, animated: false });
57
55
  }, [selectingYear, initialScrollOffset]);
58
56
 
59
57
  const { containerStyle, yearStyle } = useMemo(() => {
@@ -71,92 +69,92 @@ function YearPickerGrid() {
71
69
  }, [selectingYear]);
72
70
 
73
71
  const handleOnChange = useCallback(
74
- (year: number) => {
72
+ (value: ListItemId | null) => {
73
+ if (typeof value !== 'number') return;
75
74
  setStore(prev => ({
76
- localDate: setYear(prev.localDate, year),
75
+ localDate: setYear(prev.localDate, value),
77
76
  pickerType: undefined,
78
77
  }));
79
78
  },
80
79
  [setStore],
81
80
  );
82
81
 
82
+ const getRowLayout = useCallback(
83
+ (_data: ArrayLike<YearListItem> | null | undefined, index: number) => ({
84
+ length: GRID_ITEM_HEIGHT,
85
+ offset: GRID_ITEM_HEIGHT * index,
86
+ index,
87
+ }),
88
+ [],
89
+ );
90
+
83
91
  return (
84
- <View style={containerStyle} pointerEvents={selectingYear ? 'auto' : 'none'}>
85
- <HorizontalDivider />
86
- <ScrollView
87
- ref={scrollRef}
88
- style={gridStyles.list}
89
- contentOffset={{ x: 0, y: initialScrollOffset }}
90
- removeClippedSubviews>
91
- <View style={gridStyles.grid}>
92
- {rows.map((row, rowIdx) => (
93
- <View key={rowIdx} style={gridStyles.row}>
94
- {row.map(year => (
95
- <View key={year} style={gridStyles.cell}>
96
- <YearPill
97
- year={year}
98
- selected={selectedYear === year}
99
- onPressYear={handleOnChange}
100
- yearStyles={yearStyle}
101
- />
102
- </View>
103
- ))}
104
- {row.length < NUM_COLUMNS &&
105
- Array.from({ length: NUM_COLUMNS - row.length }).map((_, i) => (
106
- <View key={`pad-${i}`} style={gridStyles.cell} />
107
- ))}
92
+ <List multiple={false} value={selectedYear} onChange={handleOnChange}>
93
+ <View style={containerStyle} pointerEvents={selectingYear ? 'auto' : 'none'}>
94
+ <Divider />
95
+ <FlatList<YearListItem>
96
+ ref={flatListRef}
97
+ style={gridStyles.list}
98
+ data={yearItems}
99
+ numColumns={NUM_COLUMNS}
100
+ contentContainerStyle={gridStyles.grid}
101
+ columnWrapperStyle={gridStyles.row}
102
+ renderItem={({ item }) => (
103
+ <View style={gridStyles.cell}>
104
+ <YearPill year={item.id} yearStyles={yearStyle} />
108
105
  </View>
109
- ))}
110
- </View>
111
- </ScrollView>
112
- </View>
106
+ )}
107
+ keyExtractor={item => `${item.id}`}
108
+ getItemLayout={getRowLayout}
109
+ initialScrollIndex={Math.floor(initialScrollOffset / GRID_ITEM_HEIGHT)}
110
+ removeClippedSubviews
111
+ />
112
+ </View>
113
+ </List>
113
114
  );
114
115
  }
115
116
 
116
- function YearPillPure({
117
- year,
118
- selected,
119
- onPressYear,
120
- yearStyles,
121
- }: {
122
- year: number;
123
- selected: boolean;
124
- onPressYear: (newYear: number) => any;
125
- yearStyles: Record<string, any>;
126
- }) {
127
- datePickerYearItemStyles.useVariants({
128
- state: resolveStateVariant({ selected }) as any,
117
+ function YearPillPure({ year, yearStyles }: { year: number; yearStyles: Record<string, any> }) {
118
+ const isSelected = useListContextValue(state => {
119
+ const selectedValue = state.value as any;
120
+ return (selectedValue?.id ?? selectedValue) === year;
129
121
  });
130
122
 
131
- const handlePressYear = useCallback(() => {
132
- onPressYear(year);
133
- }, [year, onPressYear]);
123
+ datePickerYearItemStyles.useVariants({
124
+ state: resolveStateVariant({ selected: isSelected }) as any,
125
+ });
134
126
 
135
127
  return (
136
- <ListItem
137
- contentStyle={datePickerYearItemStyles.content}
138
- onPress={handlePressYear}
128
+ <List.Item
129
+ value={year}
139
130
  accessibilityRole="button"
140
131
  accessibilityLabel={String(year)}
141
132
  style={[yearStyles, datePickerYearItemStyles.yearButton]}
142
133
  testID={`pick-year-${year}`}>
143
- <ListItem.Title style={datePickerYearItemStyles.yearLabel} selectable={false}>
144
- {year}
145
- </ListItem.Title>
146
- </ListItem>
134
+ <View style={datePickerYearItemStyles.content}>
135
+ <Text
136
+ typescale="bodyLarge"
137
+ style={datePickerYearItemStyles.yearLabel}
138
+ selectable={false}>
139
+ {year}
140
+ </Text>
141
+ </View>
142
+ </List.Item>
147
143
  );
148
144
  }
149
145
  const YearPill = memo(YearPillPure);
150
146
 
151
147
  function YearPickerList() {
152
- const [{ startDateYear, endDateYear, localDate, pickerType }, setStore] = useDatePickerStore(
153
- state => state,
154
- );
155
- const flatList = useRef<FlatList<number> | null>(null);
148
+ const [{ startDateYear, endDateYear, localDate, pickerType }, setStore] =
149
+ useDatePickerInlineStore(state => state);
156
150
  const years = useMemo(
157
151
  () => getYearRange(startDateYear, endDateYear),
158
152
  [startDateYear, endDateYear],
159
153
  );
154
+ const yearItems = useMemo<YearListItem[]>(
155
+ () => years.map(year => ({ id: year, label: String(year) })),
156
+ [years],
157
+ );
160
158
  const selectingYear = pickerType === 'year';
161
159
  const selectedYear = localDate.getFullYear();
162
160
 
@@ -167,24 +165,18 @@ function YearPickerList() {
167
165
  }, [selectedYear, years]);
168
166
 
169
167
  const handleOnChange = useCallback(
170
- (year: number) => {
168
+ (value: ListItemId | null) => {
169
+ if (typeof value !== 'number') return;
171
170
  setStore(prev => ({
172
- localDate: setYear(prev.localDate, year),
171
+ localDate: setYear(prev.localDate, value),
173
172
  pickerType: undefined,
174
173
  }));
175
174
  },
176
175
  [setStore],
177
176
  );
178
177
 
179
- const renderItem = useCallback(
180
- ({ item }: { item: number }) => (
181
- <YearRow year={item} selected={selectedYear === item} onPressYear={handleOnChange} />
182
- ),
183
- [selectedYear, handleOnChange],
184
- );
185
-
186
178
  const getItemLayout = useCallback(
187
- (_data: any, index: number) => ({
179
+ (_data: ArrayLike<YearListItem> | null | undefined, index: number) => ({
188
180
  length: LIST_ITEM_HEIGHT,
189
181
  offset: LIST_ITEM_HEIGHT * index,
190
182
  index,
@@ -195,61 +187,54 @@ function YearPickerList() {
195
187
  if (!selectingYear) return null;
196
188
 
197
189
  return (
198
- <View style={[StyleSheet.absoluteFill, listStyles.root]} pointerEvents="auto">
199
- <HorizontalDivider />
200
- <FlatList<number>
201
- ref={flatList}
202
- style={listStyles.list}
203
- data={years}
204
- renderItem={renderItem}
205
- keyExtractor={item => `${item}`}
206
- initialScrollIndex={initialScrollIndex}
207
- getItemLayout={getItemLayout}
208
- />
209
- </View>
190
+ <List multiple={false} value={selectedYear} onChange={handleOnChange}>
191
+ <View style={[StyleSheet.absoluteFill, listStyles.root]} pointerEvents="auto">
192
+ <Divider />
193
+ <FlatList<YearListItem>
194
+ style={listStyles.list}
195
+ data={yearItems}
196
+ renderItem={({ item }) => <YearRow year={item.id} />}
197
+ keyExtractor={item => `${item.id}`}
198
+ initialScrollIndex={initialScrollIndex}
199
+ getItemLayout={getItemLayout}
200
+ />
201
+ </View>
202
+ </List>
210
203
  );
211
204
  }
212
205
 
213
- function YearRowPure({
214
- year,
215
- selected,
216
- onPressYear,
217
- }: {
218
- year: number;
219
- selected: boolean;
220
- onPressYear: (newYear: number) => any;
221
- }) {
222
- datePickerMonthItemStyles.useVariants({
223
- state: resolveStateVariant({ selected }) as any,
206
+ function YearRowPure({ year }: { year: number }) {
207
+ const isSelected = useListContextValue(state => {
208
+ const selectedValue = state.value as any;
209
+ return (selectedValue?.id ?? selectedValue) === year;
224
210
  });
225
211
 
226
- const handlePressYear = useCallback(() => {
227
- onPressYear(year);
228
- }, [year, onPressYear]);
212
+ datePickerMonthItemStyles.useVariants({
213
+ state: resolveStateVariant({ selected: isSelected }) as any,
214
+ });
229
215
 
230
216
  return (
231
- <ListItem
232
- onPress={handlePressYear}
217
+ <List.Item
218
+ value={year}
233
219
  accessibilityRole="button"
234
220
  accessibilityLabel={String(year)}
235
- accessibilityState={{ selected }}
236
221
  style={datePickerMonthItemStyles.monthButton}
237
- testID={`pick-year-${year}`}
238
- left={
239
- selected ? (
222
+ testID={`pick-year-${year}`}>
223
+ <View style={listStyles.left}>
224
+ {isSelected ? (
240
225
  <View style={listStyles.checkIconView}>
241
226
  <Icon name="check" size={24} />
242
227
  </View>
243
228
  ) : (
244
229
  <View style={listStyles.spacer} />
245
- )
246
- }>
230
+ )}
231
+ </View>
247
232
  <View style={datePickerMonthItemStyles.monthInner}>
248
233
  <Text style={datePickerMonthItemStyles.monthLabel} selectable={false}>
249
234
  {year}
250
235
  </Text>
251
236
  </View>
252
- </ListItem>
237
+ </List.Item>
253
238
  );
254
239
  }
255
240
  const YearRow = memo(YearRowPure);
@@ -260,7 +245,10 @@ const gridStyles = StyleSheet.create({
260
245
  top: 56,
261
246
  zIndex: 100,
262
247
  },
263
- list: { flex: 1 },
248
+ list: {
249
+ flex: 1,
250
+ width: '100%',
251
+ },
264
252
  grid: { alignItems: 'center' },
265
253
  row: {
266
254
  flexDirection: 'row',
@@ -289,4 +277,5 @@ const listStyles = StyleSheet.create({
289
277
  list: { flex: 1 },
290
278
  checkIconView: { marginLeft: 16 },
291
279
  spacer: { width: 44 },
280
+ left: { marginRight: 8 },
292
281
  });
@@ -1,4 +1,5 @@
1
1
  import { createFastContext } from '../../fast-context';
2
+ import { registerPortalContext } from '../Portal/Portal';
2
3
 
3
4
  export type Store = {
4
5
  localDate: Date;
@@ -16,7 +17,10 @@ export const defaultValue = {
16
17
 
17
18
  export const {
18
19
  Provider,
19
- useContext: useDatePickerStore,
20
- useContextValue: useDatePickerStoreValue,
21
- useStoreRef: useDatePickerStoreRef,
20
+ useContext: useDatePickerInlineStore,
21
+ useContextValue: useDatePickerInlineStoreValue,
22
+ useStoreRef: useDatePickerInlineStoreRef,
23
+ Context: DatePickerInlineStoreContext,
22
24
  } = createFastContext<Store>();
25
+
26
+ registerPortalContext(DatePickerInlineStoreContext);
@@ -54,7 +54,7 @@ export type BaseDatePickerProps = {
54
54
  startYear?: number;
55
55
  endYear?: number;
56
56
  HeaderComponent?: MemoExoticComponent<CalendarHeaderProps | any>;
57
- headerLayout?: 'inline' | 'docked';
57
+ headerLayout?: 'default' | 'docked';
58
58
  monthStyle?: Record<string, any>;
59
59
  showOutsideDays?: boolean;
60
60
 
@@ -0,0 +1,192 @@
1
+ import { memo } from 'react';
2
+ import { type StyleProp, View, type ViewProps, type ViewStyle } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+
5
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
6
+
7
+ export type DividerProps = Omit<ViewProps, 'children'> & {
8
+ /**
9
+ * Line orientation. Defaults to horizontal.
10
+ */
11
+ mode?: 'horizontal' | 'vertical';
12
+ /**
13
+ * Left inset when `mode` is `"horizontal"`.
14
+ */
15
+ leftInset?: number;
16
+ /**
17
+ * Right inset when `mode` is `"horizontal"`.
18
+ */
19
+ rightInset?: number;
20
+ /**
21
+ * Top inset when `mode` is `"vertical"`.
22
+ */
23
+ topInset?: number;
24
+ /**
25
+ * Bottom inset when `mode` is `"vertical"`.
26
+ */
27
+ bottomInset?: number;
28
+ /**
29
+ * Whether the divider stroke should use the bold thickness.
30
+ */
31
+ bold?: boolean;
32
+ /**
33
+ * Margin added perpendicular to the divider line (`marginVertical` for horizontal,
34
+ * `marginHorizontal` for vertical).
35
+ */
36
+ spacing?: number;
37
+ style?: StyleProp<ViewStyle>;
38
+ };
39
+
40
+ export type Props = DividerProps;
41
+
42
+ const DividerHorizontalImpl = memo(function DividerHorizontalImpl({
43
+ leftInset = 0,
44
+ rightInset = 0,
45
+ style,
46
+ bold = false,
47
+ spacing = 8,
48
+ ...rest
49
+ }: Omit<DividerProps, 'mode' | 'topInset' | 'bottomInset'>) {
50
+ horizontalDividerStyles.useVariants({
51
+ isBold: bold,
52
+ });
53
+
54
+ return (
55
+ <View
56
+ {...rest}
57
+ style={
58
+ [
59
+ horizontalDividerStyles.root,
60
+ leftInset ? { marginLeft: leftInset } : undefined,
61
+ rightInset ? { marginRight: rightInset } : undefined,
62
+ spacing ? { marginVertical: spacing } : undefined,
63
+ style,
64
+ ] as StyleProp<ViewStyle>
65
+ }
66
+ />
67
+ );
68
+ });
69
+
70
+ const DividerVerticalImpl = memo(function DividerVerticalImpl({
71
+ topInset = 0,
72
+ bottomInset = 0,
73
+ spacing = 0,
74
+ style,
75
+ bold = false,
76
+ ...rest
77
+ }: Omit<DividerProps, 'mode' | 'leftInset' | 'rightInset'>) {
78
+ verticalDividerStyles.useVariants({
79
+ isBold: bold,
80
+ });
81
+
82
+ return (
83
+ <View
84
+ {...rest}
85
+ style={
86
+ [
87
+ verticalDividerStyles.root,
88
+ style,
89
+ topInset ? { marginTop: topInset } : undefined,
90
+ bottomInset ? { marginBottom: bottomInset } : undefined,
91
+ spacing ? { marginHorizontal: spacing } : undefined,
92
+ ] as StyleProp<ViewStyle>
93
+ }
94
+ />
95
+ );
96
+ });
97
+
98
+ function DividerRoot(props: DividerProps) {
99
+ const mode = props.mode ?? 'horizontal';
100
+
101
+ if (mode === 'vertical') {
102
+ const {
103
+ mode: _m,
104
+ leftInset: _l,
105
+ rightInset: _r,
106
+ topInset,
107
+ bottomInset,
108
+ bold,
109
+ spacing,
110
+ style,
111
+ ...viewRest
112
+ } = props;
113
+
114
+ return (
115
+ <DividerVerticalImpl
116
+ {...viewRest}
117
+ topInset={topInset}
118
+ bottomInset={bottomInset}
119
+ bold={bold}
120
+ spacing={spacing}
121
+ style={style}
122
+ />
123
+ );
124
+ }
125
+
126
+ const {
127
+ mode: _m,
128
+ topInset: _t,
129
+ bottomInset: _b,
130
+ leftInset,
131
+ rightInset,
132
+ bold,
133
+ spacing,
134
+ style,
135
+ ...viewRest
136
+ } = props;
137
+
138
+ return (
139
+ <DividerHorizontalImpl
140
+ {...viewRest}
141
+ leftInset={leftInset}
142
+ rightInset={rightInset}
143
+ bold={bold}
144
+ spacing={spacing}
145
+ style={style}
146
+ />
147
+ );
148
+ }
149
+
150
+ export const Divider = memo(DividerRoot);
151
+
152
+ export const horizontalDividerStylesDefault = StyleSheet.create(theme => ({
153
+ root: {
154
+ height: StyleSheet.hairlineWidth,
155
+ background: theme.colors.outlineVariant,
156
+
157
+ variants: {
158
+ isBold: {
159
+ true: {
160
+ height: 1,
161
+ },
162
+ },
163
+ },
164
+ },
165
+ }));
166
+
167
+ export const verticalDividerStylesDefault = StyleSheet.create(theme => ({
168
+ root: {
169
+ width: StyleSheet.hairlineWidth,
170
+ background: theme.colors.outlineVariant,
171
+
172
+ variants: {
173
+ isBold: {
174
+ true: {
175
+ width: 1,
176
+ },
177
+ },
178
+ },
179
+ },
180
+ }));
181
+
182
+ export const horizontalDividerStyles = getRegisteredComponentStylesWithFallback(
183
+ 'HorizontalDivider',
184
+ horizontalDividerStylesDefault,
185
+ );
186
+
187
+ export const verticalDividerStyles = getRegisteredComponentStylesWithFallback(
188
+ 'VerticalDivider',
189
+ verticalDividerStylesDefault,
190
+ );
191
+
192
+ export default Divider;
@@ -0,0 +1,11 @@
1
+ export {
2
+ Divider,
3
+ horizontalDividerStyles,
4
+ horizontalDividerStylesDefault,
5
+ verticalDividerStyles,
6
+ verticalDividerStylesDefault,
7
+ type DividerProps,
8
+ type Props,
9
+ } from './Divider';
10
+
11
+ export { default } from './Divider';
@@ -3,13 +3,13 @@ import { type TextProps, View, type ViewProps } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
 
5
5
  import { getRegisteredComponentStylesWithFallback } from '../../core';
6
- import { HorizontalDivider, type HorizontalDividerProps } from '../HorizontalDivider';
6
+ import { Divider, type DividerProps } from '../Divider';
7
7
  import { Text } from '../Text';
8
8
 
9
9
  export type Props = ViewProps & {
10
10
  title?: ReactNode;
11
11
  showDivider?: boolean;
12
- dividerProps?: HorizontalDividerProps;
12
+ dividerProps?: Omit<DividerProps, 'mode'>;
13
13
  titleProps?: TextProps;
14
14
  };
15
15
 
@@ -45,11 +45,7 @@ const DrawerItemGroup = memo(
45
45
  )}
46
46
  </>
47
47
  {children}
48
- <>
49
- {showDivider && (
50
- <HorizontalDivider style={dividerStyle} {...dividerRestProps} />
51
- )}
52
- </>
48
+ <>{showDivider && <Divider style={dividerStyle} {...dividerRestProps} />}</>
53
49
  </View>
54
50
  );
55
51
  },
@@ -1,4 +1,3 @@
1
- import color from 'color';
2
1
  import { forwardRef, memo, useMemo } from 'react';
3
2
  import {
4
3
  type GestureResponderEvent,
@@ -112,13 +111,13 @@ const IconButton = (
112
111
  variant: variant as any,
113
112
  // @ts-ignore // TODO - fix this
114
113
  state,
114
+ // @ts-ignore // TODO - fix this
115
115
  size: typeof size === 'string' && size ? size : undefined,
116
116
  });
117
117
 
118
118
  const {
119
119
  iconColor,
120
120
  iconSize,
121
- rippleColor,
122
121
  containerStyle,
123
122
  accessibilityState,
124
123
  // accessibilityTraits,
@@ -129,18 +128,9 @@ const IconButton = (
129
128
  iconButtonSizeToIconSizeMap[size as keyof typeof iconButtonSizeToIconSizeMap] ??
130
129
  (typeof size === 'number' && size ? (size as number) : undefined);
131
130
 
132
- let _rippleColor: string | undefined;
133
-
134
- try {
135
- _rippleColor = color(_iconColor).alpha(0.12).rgb().string();
136
- } catch (e) {
137
- _rippleColor = undefined;
138
- }
139
-
140
131
  return {
141
132
  iconColor: _iconColor,
142
133
  iconSize: iconSizeInNum,
143
- rippleColor: _rippleColor,
144
134
  containerStyle: [
145
135
  iconSizeInNum
146
136
  ? {
@@ -164,7 +154,7 @@ const IconButton = (
164
154
  borderless
165
155
  centered
166
156
  onPress={onPress}
167
- rippleColor={rippleColor}
157
+ rippleAlpha={0.12}
168
158
  accessibilityLabel={accessibilityLabel}
169
159
  style={containerStyle}
170
160
  // accessibilityTraits={accessibilityTraits}