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

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 (51) hide show
  1. package/components/Card/Card.tsx +1 -1
  2. package/components/Checkbox/CheckboxBase.ios.tsx +1 -4
  3. package/components/Checkbox/CheckboxBase.tsx +2 -7
  4. package/components/DatePicker/DateCalendar.tsx +4 -4
  5. package/components/DatePicker/DatePickerModal.tsx +2 -1
  6. package/components/DatePickerInline/DatePickerDockedHeader.tsx +3 -3
  7. package/components/DatePickerInline/DatePickerInline.tsx +1 -1
  8. package/components/DatePickerInline/DatePickerInlineBase.tsx +2 -2
  9. package/components/DatePickerInline/DatePickerInlineHeader.tsx +43 -17
  10. package/components/DatePickerInline/HeaderItem.tsx +2 -2
  11. package/components/DatePickerInline/MonthPicker.tsx +64 -54
  12. package/components/DatePickerInline/Swiper.native.tsx +2 -2
  13. package/components/DatePickerInline/Swiper.tsx +3 -3
  14. package/components/DatePickerInline/YearPicker.tsx +136 -112
  15. package/components/DatePickerInline/{DatePickerContext.tsx → store.tsx} +7 -3
  16. package/components/DatePickerInline/types.ts +1 -1
  17. package/components/Divider/Divider.tsx +192 -0
  18. package/components/Divider/index.tsx +11 -0
  19. package/components/Drawer/DrawerItemGroup.tsx +3 -7
  20. package/components/IconButton/IconButton.tsx +2 -12
  21. package/components/List/List.tsx +507 -0
  22. package/components/List/context.tsx +28 -0
  23. package/components/List/index.ts +9 -0
  24. package/components/List/types.ts +149 -0
  25. package/components/{ListItem → List}/utils.ts +47 -50
  26. package/components/Menu/Menu.tsx +156 -12
  27. package/components/Menu/index.tsx +11 -7
  28. package/components/Menu/utils.ts +21 -70
  29. package/components/RadioButton/RadioButtonAndroid.tsx +38 -54
  30. package/components/RadioButton/RadioButtonIOS.tsx +2 -16
  31. package/components/Select/Select.tsx +139 -497
  32. package/components/Select/context.tsx +14 -32
  33. package/components/Select/types.ts +44 -53
  34. package/components/Select/utils.ts +15 -47
  35. package/components/Text/textFactory.tsx +17 -5
  36. package/components/TimePicker/TimeInput.tsx +2 -7
  37. package/components/TimePicker/utils.ts +0 -4
  38. package/components/TouchableRipple/TouchableRipple.native.tsx +36 -5
  39. package/components/TouchableRipple/TouchableRipple.tsx +53 -19
  40. package/components/TouchableRipple/rippleFromForegroundColor.ts +21 -0
  41. package/package.json +4 -2
  42. package/components/HorizontalDivider/HorizontalDivider.tsx +0 -103
  43. package/components/HorizontalDivider/index.tsx +0 -9
  44. package/components/ListItem/ListItem.tsx +0 -138
  45. package/components/ListItem/ListItemDescription.tsx +0 -25
  46. package/components/ListItem/ListItemTitle.tsx +0 -25
  47. package/components/ListItem/index.tsx +0 -14
  48. package/components/Menu/MenuDivider.tsx +0 -13
  49. package/components/Menu/MenuItem.tsx +0 -128
  50. package/components/VerticalDivider/VerticalDivider.tsx +0 -100
  51. 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, type FlatListProps, 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 ListContentProcessPropsArgs, 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,7 +69,8 @@ function YearPickerGrid() {
71
69
  }, [selectingYear]);
72
70
 
73
71
  const handleOnChange = useCallback(
74
- (year: number) => {
72
+ (year: number | null) => {
73
+ if (year === null) return;
75
74
  setStore(prev => ({
76
75
  localDate: setYear(prev.localDate, year),
77
76
  pickerType: undefined,
@@ -80,83 +79,103 @@ function YearPickerGrid() {
80
79
  [setStore],
81
80
  );
82
81
 
83
- 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
- ))}
108
- </View>
109
- ))}
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
+
91
+ const processGridFlatListProps = useCallback(
92
+ ({
93
+ props,
94
+ items,
95
+ isEmpty,
96
+ emptyState,
97
+ }: ListContentProcessPropsArgs<
98
+ YearListItem,
99
+ Omit<FlatListProps<YearListItem>, 'children' | 'ref'>
100
+ >): FlatListProps<YearListItem> => ({
101
+ ...props,
102
+ data: items,
103
+ numColumns: NUM_COLUMNS,
104
+ contentContainerStyle: gridStyles.grid,
105
+ columnWrapperStyle: gridStyles.row,
106
+ renderItem: ({ item }) => (
107
+ <View style={gridStyles.cell}>
108
+ <YearPill year={item.id} yearStyles={yearStyle} />
110
109
  </View>
111
- </ScrollView>
112
- </View>
110
+ ),
111
+ keyExtractor: item => `${item.id}`,
112
+ getItemLayout: getRowLayout,
113
+ initialScrollIndex: Math.floor(initialScrollOffset / GRID_ITEM_HEIGHT),
114
+ removeClippedSubviews: true,
115
+ ListEmptyComponent: isEmpty
116
+ ? function GridListEmpty() {
117
+ return <>{emptyState}</>;
118
+ }
119
+ : undefined,
120
+ }),
121
+ [getRowLayout, initialScrollOffset, yearStyle],
122
+ );
123
+
124
+ return (
125
+ <List items={yearItems} multiple={false} value={selectedYear} onChange={handleOnChange}>
126
+ <View style={containerStyle} pointerEvents={selectingYear ? 'auto' : 'none'}>
127
+ <Divider />
128
+ <List.Content<YearListItem, typeof FlatList<YearListItem>>
129
+ ref={flatListRef}
130
+ ContainerComponent={FlatList<YearListItem>}
131
+ style={gridStyles.list}
132
+ processProps={processGridFlatListProps}
133
+ />
134
+ </View>
135
+ </List>
113
136
  );
114
137
  }
115
138
 
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,
139
+ function YearPillPure({ year, yearStyles }: { year: number; yearStyles: Record<string, any> }) {
140
+ const isSelected = useListContextValue(state => {
141
+ const selectedValue = state.value as any;
142
+ return (selectedValue?.id ?? selectedValue) === year;
129
143
  });
130
144
 
131
- const handlePressYear = useCallback(() => {
132
- onPressYear(year);
133
- }, [year, onPressYear]);
145
+ datePickerYearItemStyles.useVariants({
146
+ state: resolveStateVariant({ selected: isSelected }) as any,
147
+ });
134
148
 
135
149
  return (
136
- <ListItem
150
+ <List.Item
151
+ value={year}
137
152
  contentStyle={datePickerYearItemStyles.content}
138
- onPress={handlePressYear}
139
153
  accessibilityRole="button"
140
154
  accessibilityLabel={String(year)}
141
155
  style={[yearStyles, datePickerYearItemStyles.yearButton]}
142
156
  testID={`pick-year-${year}`}>
143
- <ListItem.Title style={datePickerYearItemStyles.yearLabel} selectable={false}>
157
+ <Text
158
+ typescale="bodyLarge"
159
+ style={datePickerYearItemStyles.yearLabel}
160
+ selectable={false}>
144
161
  {year}
145
- </ListItem.Title>
146
- </ListItem>
162
+ </Text>
163
+ </List.Item>
147
164
  );
148
165
  }
149
166
  const YearPill = memo(YearPillPure);
150
167
 
151
168
  function YearPickerList() {
152
- const [{ startDateYear, endDateYear, localDate, pickerType }, setStore] = useDatePickerStore(
153
- state => state,
154
- );
155
- const flatList = useRef<FlatList<number> | null>(null);
169
+ const [{ startDateYear, endDateYear, localDate, pickerType }, setStore] =
170
+ useDatePickerInlineStore(state => state);
156
171
  const years = useMemo(
157
172
  () => getYearRange(startDateYear, endDateYear),
158
173
  [startDateYear, endDateYear],
159
174
  );
175
+ const yearItems = useMemo<YearListItem[]>(
176
+ () => years.map(year => ({ id: year, label: String(year) })),
177
+ [years],
178
+ );
160
179
  const selectingYear = pickerType === 'year';
161
180
  const selectedYear = localDate.getFullYear();
162
181
 
@@ -167,7 +186,8 @@ function YearPickerList() {
167
186
  }, [selectedYear, years]);
168
187
 
169
188
  const handleOnChange = useCallback(
170
- (year: number) => {
189
+ (year: number | null) => {
190
+ if (year === null) return;
171
191
  setStore(prev => ({
172
192
  localDate: setYear(prev.localDate, year),
173
193
  pickerType: undefined,
@@ -176,15 +196,8 @@ function YearPickerList() {
176
196
  [setStore],
177
197
  );
178
198
 
179
- const renderItem = useCallback(
180
- ({ item }: { item: number }) => (
181
- <YearRow year={item} selected={selectedYear === item} onPressYear={handleOnChange} />
182
- ),
183
- [selectedYear, handleOnChange],
184
- );
185
-
186
199
  const getItemLayout = useCallback(
187
- (_data: any, index: number) => ({
200
+ (_data: ArrayLike<YearListItem> | null | undefined, index: number) => ({
188
201
  length: LIST_ITEM_HEIGHT,
189
202
  offset: LIST_ITEM_HEIGHT * index,
190
203
  index,
@@ -192,51 +205,59 @@ function YearPickerList() {
192
205
  [],
193
206
  );
194
207
 
208
+ const processFlatListProps = useCallback(
209
+ ({
210
+ props,
211
+ items,
212
+ }: ListContentProcessPropsArgs<
213
+ YearListItem,
214
+ Omit<FlatListProps<YearListItem>, 'children' | 'ref'>
215
+ >): FlatListProps<YearListItem> => ({
216
+ ...props,
217
+ data: items,
218
+ renderItem: ({ item }) => <YearRow year={item.id} />,
219
+ keyExtractor: item => `${item.id}`,
220
+ initialScrollIndex,
221
+ getItemLayout,
222
+ }),
223
+ [getItemLayout, initialScrollIndex],
224
+ );
225
+
195
226
  if (!selectingYear) return null;
196
227
 
197
228
  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>
229
+ <List items={yearItems} multiple={false} value={selectedYear} onChange={handleOnChange}>
230
+ <View style={[StyleSheet.absoluteFill, listStyles.root]} pointerEvents="auto">
231
+ <Divider />
232
+ <List.Content<YearListItem, typeof FlatList<YearListItem>>
233
+ ContainerComponent={FlatList<YearListItem>}
234
+ style={listStyles.list}
235
+ processProps={processFlatListProps}
236
+ />
237
+ </View>
238
+ </List>
210
239
  );
211
240
  }
212
241
 
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,
242
+ function YearRowPure({ year }: { year: number }) {
243
+ const isSelected = useListContextValue(state => {
244
+ const selectedValue = state.value as any;
245
+ return (selectedValue?.id ?? selectedValue) === year;
224
246
  });
225
247
 
226
- const handlePressYear = useCallback(() => {
227
- onPressYear(year);
228
- }, [year, onPressYear]);
248
+ datePickerMonthItemStyles.useVariants({
249
+ state: resolveStateVariant({ selected: isSelected }) as any,
250
+ });
229
251
 
230
252
  return (
231
- <ListItem
232
- onPress={handlePressYear}
253
+ <List.Item
254
+ value={year}
233
255
  accessibilityRole="button"
234
256
  accessibilityLabel={String(year)}
235
- accessibilityState={{ selected }}
236
257
  style={datePickerMonthItemStyles.monthButton}
237
258
  testID={`pick-year-${year}`}
238
259
  left={
239
- selected ? (
260
+ isSelected ? (
240
261
  <View style={listStyles.checkIconView}>
241
262
  <Icon name="check" size={24} />
242
263
  </View>
@@ -249,7 +270,7 @@ function YearRowPure({
249
270
  {year}
250
271
  </Text>
251
272
  </View>
252
- </ListItem>
273
+ </List.Item>
253
274
  );
254
275
  }
255
276
  const YearRow = memo(YearRowPure);
@@ -260,7 +281,10 @@ const gridStyles = StyleSheet.create({
260
281
  top: 56,
261
282
  zIndex: 100,
262
283
  },
263
- list: { flex: 1 },
284
+ list: {
285
+ flex: 1,
286
+ width: '100%',
287
+ },
264
288
  grid: { alignItems: 'center' },
265
289
  row: {
266
290
  flexDirection: 'row',
@@ -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}