Skip to content

Commit ac4e178

Browse files
committed
feat: remove customRippleColor from components
* fixes #4894
1 parent 5a6ec84 commit ac4e178

32 files changed

Lines changed: 20 additions & 513 deletions

src/components/Appbar/AppbarAction.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import * as React from 'react';
2-
import type {
3-
Animated,
4-
ColorValue,
5-
StyleProp,
6-
View,
7-
ViewStyle,
8-
} from 'react-native';
2+
import type { Animated, StyleProp, View, ViewStyle } from 'react-native';
93

104
import type { ThemeProp } from 'src/types';
115

@@ -20,10 +14,6 @@ export type Props = React.ComponentPropsWithoutRef<typeof IconButton> & {
2014
* Custom color for action icon.
2115
*/
2216
color?: string;
23-
/**
24-
* Color of the ripple effect.
25-
*/
26-
rippleColor?: ColorValue;
2717
/**
2818
* Name of the icon to show.
2919
*/
@@ -91,7 +81,6 @@ const AppbarAction = forwardRef<View, Props>(
9181
accessibilityLabel,
9282
isLeading,
9383
theme: themeOverrides,
94-
rippleColor,
9584
...rest
9685
}: Props,
9786
ref
@@ -115,7 +104,6 @@ const AppbarAction = forwardRef<View, Props>(
115104
accessibilityLabel={accessibilityLabel}
116105
animated
117106
ref={ref}
118-
rippleColor={rippleColor}
119107
{...rest}
120108
/>
121109
);

src/components/Button/Button.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from 'react';
22
import {
33
AccessibilityRole,
44
Animated,
5-
ColorValue,
65
GestureResponderEvent,
76
Platform,
87
PressableAndroidRippleConfig,
@@ -13,8 +12,6 @@ import {
1312
ViewStyle,
1413
} from 'react-native';
1514

16-
import color from 'color';
17-
1815
import {
1916
ButtonMode,
2017
getButtonColors,
@@ -66,10 +63,6 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
6663
* Custom button's text color.
6764
*/
6865
textColor?: string;
69-
/**
70-
* Color of the ripple effect.
71-
*/
72-
rippleColor?: ColorValue;
7366
/**
7467
* Whether to show a loading indicator.
7568
*/
@@ -186,7 +179,6 @@ const Button = (
186179
icon,
187180
buttonColor: customButtonColor,
188181
textColor: customTextColor,
189-
rippleColor: customRippleColor,
190182
children,
191183
accessibilityLabel,
192184
accessibilityHint,
@@ -292,9 +284,6 @@ const Button = (
292284
dark,
293285
});
294286

295-
const rippleColor =
296-
customRippleColor || color(textColor).alpha(0.12).rgb().string();
297-
298287
const touchableStyle = {
299288
...borderRadiusStyles,
300289
borderRadius: borderRadiusStyles.borderRadius ?? borderRadius,
@@ -363,7 +352,6 @@ const Button = (
363352
accessible={accessible}
364353
hitSlop={hitSlop}
365354
disabled={disabled}
366-
rippleColor={rippleColor}
367355
style={getButtonTouchableRippleStyle(touchableStyle, borderWidth)}
368356
testID={testID}
369357
theme={theme}

src/components/Checkbox/CheckboxItem.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import {
3-
ColorValue,
43
GestureResponderEvent,
54
PressableAndroidRippleConfig,
65
StyleProp,
@@ -58,10 +57,6 @@ export type Props = {
5857
* Custom color for checkbox.
5958
*/
6059
color?: string;
61-
/**
62-
* Color of the ripple effect.
63-
*/
64-
rippleColor?: ColorValue;
6560
/**
6661
* Additional styles for container View.
6762
*/
@@ -148,7 +143,6 @@ const CheckboxItem = ({
148143
disabled,
149144
labelVariant = 'bodyLarge',
150145
labelMaxFontSizeMultiplier = 1.5,
151-
rippleColor,
152146
background,
153147
hitSlop,
154148
...props
@@ -187,7 +181,6 @@ const CheckboxItem = ({
187181
onLongPress={onLongPress}
188182
testID={testID}
189183
disabled={disabled}
190-
rippleColor={rippleColor}
191184
theme={theme}
192185
background={background}
193186
hitSlop={hitSlop}

src/components/Chip/Chip.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from 'react';
22
import {
33
AccessibilityState,
44
Animated,
5-
ColorValue,
65
GestureResponderEvent,
76
Platform,
87
PressableAndroidRippleConfig,
@@ -73,10 +72,6 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
7372
* Note: Check will not be shown if `icon` is specified. If specified, `icon` will be shown regardless of `selected`.
7473
*/
7574
showSelectedCheck?: boolean;
76-
/**
77-
* Color of the ripple effect.
78-
*/
79-
rippleColor?: ColorValue;
8075
/**
8176
* Whether the chip is disabled. A disabled chip is greyed out and `onPress` is not called on touch.
8277
*/
@@ -201,7 +196,6 @@ const Chip = ({
201196
theme: themeOverrides,
202197
testID = 'chip',
203198
selectedColor,
204-
rippleColor: customRippleColor,
205199
showSelectedOverlay = false,
206200
showSelectedCheck = true,
207201
ellipsizeMode,
@@ -263,7 +257,6 @@ const Chip = ({
263257
borderColor,
264258
textColor,
265259
iconColor,
266-
rippleColor,
267260
selectedBackgroundColor,
268261
backgroundColor,
269262
} = getChipColors({
@@ -273,7 +266,6 @@ const Chip = ({
273266
showSelectedOverlay,
274267
customBackgroundColor,
275268
disabled,
276-
customRippleColor,
277269
});
278270

279271
const accessibilityState: AccessibilityState = {
@@ -324,7 +316,6 @@ const Chip = ({
324316
onPressIn={hasPassedTouchHandler ? handlePressIn : undefined}
325317
onPressOut={hasPassedTouchHandler ? handlePressOut : undefined}
326318
delayLongPress={delayLongPress}
327-
rippleColor={rippleColor}
328319
disabled={disabled}
329320
accessibilityLabel={accessibilityLabel}
330321
accessibilityRole={accessibilityRole}

src/components/Chip/helpers.tsx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -171,51 +171,18 @@ const getIconColor = ({
171171
return colors.onSecondaryContainer;
172172
};
173173

174-
const getRippleColor = ({
175-
theme,
176-
isOutlined,
177-
disabled,
178-
selectedColor,
179-
selectedBackgroundColor: _selectedBackgroundColor,
180-
customRippleColor,
181-
}: BaseProps & {
182-
selectedBackgroundColor: string;
183-
selectedColor?: string;
184-
customRippleColor?: ColorValue;
185-
}) => {
186-
if (customRippleColor) {
187-
return customRippleColor;
188-
}
189-
190-
const isSelectedColor = selectedColor !== undefined;
191-
const textColor = getTextColor({
192-
theme,
193-
disabled,
194-
selectedColor,
195-
isOutlined,
196-
});
197-
198-
if (isSelectedColor) {
199-
return color(selectedColor).alpha(0.12).rgb().string();
200-
}
201-
202-
return color(textColor).alpha(0.12).rgb().string();
203-
};
204-
205174
export const getChipColors = ({
206175
isOutlined,
207176
theme,
208177
selectedColor,
209178
showSelectedOverlay,
210179
customBackgroundColor,
211180
disabled,
212-
customRippleColor,
213181
}: BaseProps & {
214182
customBackgroundColor?: ColorValue;
215183
disabled?: boolean;
216184
showSelectedOverlay?: boolean;
217185
selectedColor?: string;
218-
customRippleColor?: ColorValue;
219186
}) => {
220187
const baseChipColorProps = { theme, isOutlined, disabled };
221188

@@ -244,12 +211,6 @@ export const getChipColors = ({
244211
...baseChipColorProps,
245212
selectedColor,
246213
}),
247-
rippleColor: getRippleColor({
248-
...baseChipColorProps,
249-
selectedColor,
250-
selectedBackgroundColor,
251-
customRippleColor,
252-
}),
253214
backgroundColor,
254215
selectedBackgroundColor,
255216
};

src/components/DataTable/DataTablePagination.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
22
import {
3-
ColorValue,
43
I18nManager,
54
StyleProp,
65
StyleSheet,
@@ -57,14 +56,6 @@ type PaginationDropdownProps = {
5756
* The function to set the number of rows per page.
5857
*/
5958
onItemsPerPageChange?: (numberOfItemsPerPage: number) => void;
60-
/**
61-
* Color of the dropdown item ripple effect.
62-
*/
63-
dropdownItemRippleColor?: ColorValue;
64-
/**
65-
* Color of the select page dropdown ripple effect.
66-
*/
67-
selectPageDropdownRippleColor?: ColorValue;
6859
/**
6960
* @optional
7061
*/
@@ -88,10 +79,6 @@ type PaginationControlsProps = {
8879
* Whether to show fast forward and fast rewind buttons in pagination. False by default.
8980
*/
9081
showFastPaginationControls?: boolean;
91-
/**
92-
* Color of the pagination control ripple effect.
93-
*/
94-
paginationControlRippleColor?: ColorValue;
9582
/**
9683
* @optional
9784
*/
@@ -104,7 +91,6 @@ const PaginationControls = ({
10491
onPageChange,
10592
showFastPaginationControls,
10693
theme: themeOverrides,
107-
paginationControlRippleColor,
10894
}: PaginationControlsProps) => {
10995
const theme = useInternalTheme(themeOverrides);
11096

@@ -123,7 +109,6 @@ const PaginationControls = ({
123109
/>
124110
)}
125111
iconColor={textColor}
126-
rippleColor={paginationControlRippleColor}
127112
disabled={page === 0}
128113
onPress={() => onPageChange(0)}
129114
accessibilityLabel="page-first"
@@ -140,7 +125,6 @@ const PaginationControls = ({
140125
/>
141126
)}
142127
iconColor={textColor}
143-
rippleColor={paginationControlRippleColor}
144128
disabled={page === 0}
145129
onPress={() => onPageChange(page - 1)}
146130
accessibilityLabel="chevron-left"
@@ -156,7 +140,6 @@ const PaginationControls = ({
156140
/>
157141
)}
158142
iconColor={textColor}
159-
rippleColor={paginationControlRippleColor}
160143
disabled={numberOfPages === 0 || page === numberOfPages - 1}
161144
onPress={() => onPageChange(page + 1)}
162145
accessibilityLabel="chevron-right"
@@ -173,7 +156,6 @@ const PaginationControls = ({
173156
/>
174157
)}
175158
iconColor={textColor}
176-
rippleColor={paginationControlRippleColor}
177159
disabled={numberOfPages === 0 || page === numberOfPages - 1}
178160
onPress={() => onPageChange(numberOfPages - 1)}
179161
accessibilityLabel="page-last"
@@ -189,8 +171,6 @@ const PaginationDropdown = ({
189171
numberOfItemsPerPage,
190172
onItemsPerPageChange,
191173
theme: themeOverrides,
192-
selectPageDropdownRippleColor,
193-
dropdownItemRippleColor,
194174
}: PaginationDropdownProps) => {
195175
const theme = useInternalTheme(themeOverrides);
196176
const { colors } = theme;
@@ -209,7 +189,6 @@ const PaginationDropdown = ({
209189
icon="menu-down"
210190
contentStyle={styles.contentStyle}
211191
theme={theme}
212-
rippleColor={selectPageDropdownRippleColor}
213192
>
214193
{`${numberOfItemsPerPage}`}
215194
</Button>
@@ -227,7 +206,6 @@ const PaginationDropdown = ({
227206
onItemsPerPageChange?.(option);
228207
toggleSelect(false);
229208
}}
230-
rippleColor={dropdownItemRippleColor}
231209
title={option}
232210
theme={theme}
233211
/>
@@ -304,8 +282,6 @@ const DataTablePagination = ({
304282
onItemsPerPageChange,
305283
selectPageDropdownLabel,
306284
selectPageDropdownAccessibilityLabel,
307-
selectPageDropdownRippleColor,
308-
dropdownItemRippleColor,
309285
theme: themeOverrides,
310286
...rest
311287
}: Props) => {
@@ -339,8 +315,6 @@ const DataTablePagination = ({
339315
numberOfItemsPerPageList={numberOfItemsPerPageList}
340316
numberOfItemsPerPage={numberOfItemsPerPage}
341317
onItemsPerPageChange={onItemsPerPageChange}
342-
selectPageDropdownRippleColor={selectPageDropdownRippleColor}
343-
dropdownItemRippleColor={dropdownItemRippleColor}
344318
theme={theme}
345319
/>
346320
</View>

0 commit comments

Comments
 (0)